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 /svtools/source | |
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 'svtools/source')
-rw-r--r-- | svtools/source/config/itemholder2.cxx | 4 | ||||
-rw-r--r-- | svtools/source/misc/acceleratorexecute.cxx | 4 | ||||
-rw-r--r-- | svtools/source/uno/popupmenucontrollerbase.cxx | 14 |
3 files changed, 12 insertions, 10 deletions
diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index c6b1034618ba..cbd78826d7c0 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -90,7 +90,7 @@ void SAL_CALL ItemHolder2::disposing(const css::lang::EventObject&) void ItemHolder2::impl_addItem(EItem eItem) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); for ( auto const & rInfo : m_lItems ) { @@ -110,7 +110,7 @@ void ItemHolder2::impl_releaseAllItems() { std::vector<TItemInfo> items; { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); items.swap(m_lItems); } diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 8ecfd2d64680..65632e04cb07 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -182,7 +182,7 @@ bool AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey) } // SAFE -> ---------------------------------- - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aLock); css::uno::Reference< css::frame::XDispatchProvider > xProvider = m_xDispatcher; @@ -247,7 +247,7 @@ OUString AcceleratorExecute::findCommand(const css::awt::KeyEvent& aKey) OUString AcceleratorExecute::impl_ts_findCommand(const css::awt::KeyEvent& aKey) { // SAFE -> ---------------------------------- - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aLock); css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg = m_xGlobalCfg; css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg = m_xModuleCfg; diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 8bf253442d55..9ce87c67c0af 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -167,9 +167,10 @@ void SAL_CALL PopupMenuControllerBase::itemDeactivated( const awt::MenuEvent& ) void SAL_CALL PopupMenuControllerBase::updatePopupMenu() { - osl::ClearableMutexGuard aLock( m_aMutex ); - throwIfDisposed(); - aLock.clear(); + { + osl::MutexGuard aLock(m_aMutex); + throwIfDisposed(); + } updateCommand( m_aCommandURL ); } @@ -211,9 +212,10 @@ Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispat { // Create return list - which must have same size then the given descriptor // It's not allowed to pack it! - osl::ClearableMutexGuard aLock( m_aMutex ); - throwIfDisposed(); - aLock.clear(); + { + osl::MutexGuard aLock(m_aMutex); + throwIfDisposed(); + } sal_Int32 nCount = lDescriptor.getLength(); uno::Sequence< uno::Reference< frame::XDispatch > > lDispatcher( nCount ); |