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 /chart2 | |
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 'chart2')
-rw-r--r-- | chart2/source/controller/accessibility/AccessibleBase.cxx | 39 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 4 |
2 files changed, 22 insertions, 21 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index ce2c5769c812..281c86ca203d 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -56,7 +56,6 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::Reference; using ::osl::MutexGuard; using ::osl::ClearableMutexGuard; -using ::osl::ResettableMutexGuard; using ::com::sun::star::uno::Any; namespace chart @@ -412,29 +411,31 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo ) // ________ (XComponent::dispose) ________ void SAL_CALL AccessibleBase::disposing() { - ClearableMutexGuard aGuard( GetMutex() ); - OSL_ENSURE( ! m_bIsDisposed, "dispose() called twice" ); - - // notify disposing to all AccessibleEvent listeners asynchron - if ( m_nEventNotifierId ) { - ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( m_nEventNotifierId, *this ); - m_nEventNotifierId = 0; - } + MutexGuard aGuard(GetMutex()); + OSL_ENSURE(!m_bIsDisposed, "dispose() called twice"); + + // notify disposing to all AccessibleEvent listeners asynchron + if (m_nEventNotifierId) + { + ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(m_nEventNotifierId, + *this); + m_nEventNotifierId = 0; + } - // reset pointers - m_aAccInfo.m_pParent = nullptr; + // reset pointers + m_aAccInfo.m_pParent = nullptr; - // attach new empty state set helper to member reference - ::utl::AccessibleStateSetHelper * pHelper = new ::utl::AccessibleStateSetHelper(); - pHelper->AddState( AccessibleStateType::DEFUNC ); - // release old helper and attach new one - m_xStateSetHelper = pHelper; + // attach new empty state set helper to member reference + ::utl::AccessibleStateSetHelper * pHelper = new ::utl::AccessibleStateSetHelper(); + pHelper->AddState(AccessibleStateType::DEFUNC); + // release old helper and attach new one + m_xStateSetHelper = pHelper; - m_bIsDisposed = true; + m_bIsDisposed = true; + } // call listeners unguarded - aGuard.clear(); if( m_bMayHaveChildren ) { @@ -480,7 +481,7 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int32 CheckDisposeState(); Reference< XAccessible > xResult; - ResettableMutexGuard aGuard( GetMutex() ); + ClearableMutexGuard aGuard( GetMutex() ); bool bMustUpdateChildren = ( m_bMayHaveChildren && ! m_bChildrenInitialized ); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index b2e493e8d46e..872406f9f16b 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2453,7 +2453,7 @@ void ChartView::createShapes() { SolarMutexGuard aSolarGuard; - osl::ResettableMutexGuard aTimedGuard(maTimeMutex); + osl::MutexGuard aTimedGuard(maTimeMutex); if(mrChartModel.isTimeBased()) { maTimeBased.bTimeBased = true; @@ -2927,7 +2927,7 @@ OUString ChartView::dump() void ChartView::setViewDirty() { - osl::ResettableMutexGuard aGuard(maTimeMutex); + osl::MutexGuard aGuard(maTimeMutex); m_bViewDirty = true; } |