Kaydet (Commit) 82282271 authored tarafından Noel Grandin's avatar Noel Grandin

convert OSL_ENSURE to assert in AccessibleEventNotifier

and fix the places that trigger it

Change-Id: I97a04cff25ab5aa1d42c79a971d15ba742bf384e
Reviewed-on: https://gerrit.libreoffice.org/31760Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e794ce1e
...@@ -151,7 +151,7 @@ namespace comphelper ...@@ -151,7 +151,7 @@ namespace comphelper
if ( !isAlive() ) if ( !isAlive() )
return; return;
if ( _rxListener.is() ) if ( _rxListener.is() && m_pImpl->getClientId() )
{ {
sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( m_pImpl->getClientId( ), _rxListener ); sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( m_pImpl->getClientId( ), _rxListener );
if ( !nListenerCount ) if ( !nListenerCount )
......
...@@ -130,7 +130,7 @@ namespace ...@@ -130,7 +130,7 @@ namespace
// look up this client // look up this client
ClientMap &rClients = Clients::get(); ClientMap &rClients = Clients::get();
rPos = rClients.find( nClient ); rPos = rClients.find( nClient );
OSL_ENSURE( rClients.end() != rPos, assert( rClients.end() != rPos &&
"AccessibleEventNotifier::implLookupClient: invalid client id " "AccessibleEventNotifier::implLookupClient: invalid client id "
"(did you register your client?)!" ); "(did you register your client?)!" );
......
...@@ -260,7 +260,7 @@ void SAL_CALL SvtRulerAccessible::addAccessibleEventListener( const uno::Referen ...@@ -260,7 +260,7 @@ void SAL_CALL SvtRulerAccessible::addAccessibleEventListener( const uno::Referen
void SAL_CALL SvtRulerAccessible::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) void SAL_CALL SvtRulerAccessible::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
throw( RuntimeException, std::exception ) throw( RuntimeException, std::exception )
{ {
if (xListener.is()) if (xListener.is() && mnClientId)
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
...@@ -332,23 +332,16 @@ void SAL_CALL SvtRulerAccessible::disposing() ...@@ -332,23 +332,16 @@ void SAL_CALL SvtRulerAccessible::disposing()
{ {
if( !rBHelper.bDisposed ) if( !rBHelper.bDisposed )
{ {
{ ::osl::MutexGuard aGuard( m_aMutex );
::osl::MutexGuard aGuard( m_aMutex ); mpRepr = nullptr; // object dies with representation
mpRepr = nullptr; // object dies with representation
}
// Send a disposing to all listeners.
if ( mnClientId )
{ {
::osl::MutexGuard aGuard( m_aMutex ); comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
mnClientId = 0;
// Send a disposing to all listeners.
if ( mnClientId )
{
comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
mnClientId = 0;
}
mxParent.clear();
} }
mxParent.clear();
} }
} }
......
...@@ -730,7 +730,7 @@ void SAL_CALL SwAccessibleContext::removeAccessibleEventListener( ...@@ -730,7 +730,7 @@ void SAL_CALL SwAccessibleContext::removeAccessibleEventListener(
const uno::Reference< XAccessibleEventListener >& xListener ) const uno::Reference< XAccessibleEventListener >& xListener )
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
if (xListener.is()) if (xListener.is() && m_nClientId)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment