simplify CloseableLifeTimeManager a little

Change-Id: Iad50da94acc1ad476b98762ff3ab3f0f677d5f56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183395
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2025-03-27 17:35:52 +01:00
parent ffbc219836
commit 8381240aaf
2 changed files with 5 additions and 12 deletions
+1 -2
View File
@@ -92,7 +92,7 @@ public:
bool g_close_startTryClose(bool bDeliverOwnership);
/// @throws css::util::CloseVetoException
void g_close_isNeedToCancelLongLastingCalls( bool bDeliverOwnership, css::util::CloseVetoException const & ex );
void g_close_endTryClose(bool bDeliverOwnership );
void g_close_endTryClose();
void g_close_endTryClose_doClose();
/// @throws css::uno::RuntimeException
void g_addCloseListener( const css::uno::Reference< css::util::XCloseListener > & xListener );
@@ -101,7 +101,6 @@ private:
virtual bool impl_canStartApiCall() override;
virtual void impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& rGuard) override;
void impl_setOwnership( bool bDeliverOwnership, bool bMyVeto );
void impl_doClose(std::unique_lock<std::mutex>& rGuard);
};
+4 -10
View File
@@ -231,18 +231,18 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership)
catch( const uno::Exception& )
{
//no mutex is acquired
g_close_endTryClose(bDeliverOwnership);
g_close_endTryClose();
throw;
}
return true;
}
void CloseableLifeTimeManager::g_close_endTryClose(bool bDeliverOwnership )
void CloseableLifeTimeManager::g_close_endTryClose()
{
//this method is called, if the try to close was not successful
std::unique_lock aGuard( m_aAccessMutex );
impl_setOwnership( bDeliverOwnership, false );
m_bOwnership = false;
m_bInTryClose = false;
m_aEndTryClosingCondition.set();
@@ -263,8 +263,7 @@ void CloseableLifeTimeManager::g_close_isNeedToCancelLongLastingCalls( bool bDel
if( !m_nLongLastingCallCount )
return;
impl_setOwnership( bDeliverOwnership, true );
m_bOwnership = bDeliverOwnership;
m_bInTryClose = false;
m_aEndTryClosingCondition.set();
@@ -289,11 +288,6 @@ void CloseableLifeTimeManager::g_close_endTryClose_doClose()
impl_doClose(aGuard);
}
void CloseableLifeTimeManager::impl_setOwnership( bool bDeliverOwnership, bool bMyVeto )
{
m_bOwnership = bDeliverOwnership && bMyVeto;
}
void CloseableLifeTimeManager::impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& rGuard)
{
//Mutex needs to be acquired exactly once