diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-07 11:48:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-07 17:53:04 +0200 |
commit | 5a824268dfdd48c00f656b767b48cd12ccbdaabb (patch) | |
tree | a25f4afd3ca49cff41fc44559aedea70c82e6c7e /sd | |
parent | a6186a678cd9f67359da885606b3c3983f6bdc74 (diff) |
Don't use resettable/clearable guard where plain guard is enough
Also use scope where possible. This allows to limit guard scope at
language level; visualises the scope clearly; and helps avoiding
errors like fixed in commit 61e4437c857854b331fa01da6f39b2b3b58a800b.
Change-Id: Ifeca96e2df8e8a0897770d9546b2536806275f41
Reviewed-on: https://gerrit.libreoffice.org/70376
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/stlsheet.cxx | 11 | ||||
-rw-r--r-- | sd/source/ui/dlg/RemoteDialogClientBox.cxx | 30 |
2 files changed, 20 insertions, 21 deletions
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 4e81c7304a5c..393160b81926 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -714,12 +714,13 @@ void SAL_CALL SdStyleSheet::release( ) throw () void SAL_CALL SdStyleSheet::dispose( ) { - ClearableMutexGuard aGuard( mrBHelper.rMutex ); - if (mrBHelper.bDisposed || mrBHelper.bInDispose) - return; + { + MutexGuard aGuard(mrBHelper.rMutex); + if (mrBHelper.bDisposed || mrBHelper.bInDispose) + return; - mrBHelper.bInDispose = true; - aGuard.clear(); + mrBHelper.bInDispose = true; + } try { // side effect: keeping a reference to this diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx index 3e976b90c6dd..ad1355644a23 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx @@ -184,7 +184,7 @@ void ClientBox::selectEntry( const long nPos ) //It would be probably best to always use a copy of m_vEntries //and some other state variables from ClientBox for //the whole painting operation. See issue i86993 - ::osl::ClearableMutexGuard guard(m_entriesMutex); + osl::MutexGuard guard(m_entriesMutex); if ( m_bHasActive ) { @@ -230,8 +230,6 @@ void ClientBox::selectEntry( const long nPos ) m_bNeedsRecalc = true; Invalidate(); } - - guard.clear(); } void ClientBox::DrawRow(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect, const TClientBoxEntry& rEntry) @@ -583,21 +581,21 @@ void ClientBox::addEntry( const std::shared_ptr<ClientInfo>& pClientInfo ) TClientBoxEntry xEntry( new ClientBoxEntry( pClientInfo ) ); - ::osl::ClearableMutexGuard guard(m_entriesMutex); - if ( m_vEntries.empty() ) { - m_vEntries.push_back( xEntry ); - } - else - { - m_vEntries.insert( m_vEntries.begin()+nPos, xEntry ); - } - - //access to m_nActive must be guarded - if ( m_bHasActive && ( m_nActive >= nPos ) ) - m_nActive += 1; + osl::MutexGuard guard(m_entriesMutex); + if (m_vEntries.empty()) + { + m_vEntries.push_back(xEntry); + } + else + { + m_vEntries.insert(m_vEntries.begin() + nPos, xEntry); + } - guard.clear(); + //access to m_nActive must be guarded + if (m_bHasActive && (m_nActive >= nPos)) + m_nActive += 1; + } if ( IsReallyVisible() ) Invalidate(); |