diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 15:11:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 21:46:57 +0200 |
commit | 4f3f61a621a0e66fd0eab4886a3aa51e10513ad3 (patch) | |
tree | 03fa6f0fa067e6d7805cfa95e1c234f7821d4f42 /accessibility/source/extended/accessiblelistboxentry.cxx | |
parent | 8d4fd3418322f3f6852054c44be2cd74b0db76ee (diff) |
loplugin:flatten in accessibility
Change-Id: I5e02fe0288845210f1d8e41db0342967858098fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92487
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility/source/extended/accessiblelistboxentry.cxx')
-rw-r--r-- | accessibility/source/extended/accessiblelistboxentry.cxx | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 7b5b055f4d95..22dc36aef3a1 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -96,20 +96,20 @@ namespace accessibility OSL_ENSURE( rEvent.GetWindow() , "AccessibleListBoxEntry::WindowEventListener: no event window!" ); OSL_ENSURE( rEvent.GetWindow() == m_pTreeListBox, "AccessibleListBoxEntry::WindowEventListener: where did this come from?" ); - if ( m_pTreeListBox != nullptr ) + if ( m_pTreeListBox == nullptr ) + return; + + switch ( rEvent.GetId() ) { - switch ( rEvent.GetId() ) + case VclEventId::ObjectDying : { - case VclEventId::ObjectDying : - { - if ( m_pTreeListBox ) - m_pTreeListBox->RemoveEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); - m_pTreeListBox = nullptr; - dispose(); - break; - } - default: break; + if ( m_pTreeListBox ) + m_pTreeListBox->RemoveEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); + m_pTreeListBox = nullptr; + dispose(); + break; } + default: break; } } @@ -710,22 +710,22 @@ namespace accessibility void SAL_CALL AccessibleListBoxEntry::removeAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener ) { - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); + if (!xListener.is()) + return; - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - sal_Int32 nId = m_nClientId; - m_nClientId = 0; - comphelper::AccessibleEventNotifier::revokeClient( nId ); + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); + if ( !nListenerCount ) + { + // no listeners anymore + // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case somebody calls + // NotifyAccessibleEvent, again + sal_Int32 nId = m_nClientId; + m_nClientId = 0; + comphelper::AccessibleEventNotifier::revokeClient( nId ); - } } } |