diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2002-07-10 14:20:59 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2002-07-10 14:20:59 +0000 |
commit | c4229013eeeb691c310afe89ecfcc73d4dd22bce (patch) | |
tree | bd95b18c4fee3845d713a1e1aef640cefeebdeca /cppuhelper/source/implbase.cxx | |
parent | 05ba37abcf1ff8f82d4d4c1837f8675c9ca9a0b9 (diff) |
#101182# fixing needed guards for listener management
Diffstat (limited to 'cppuhelper/source/implbase.cxx')
-rw-r--r-- | cppuhelper/source/implbase.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx index 30d270369ede..5d5d64357ad9 100644 --- a/cppuhelper/source/implbase.cxx +++ b/cppuhelper/source/implbase.cxx @@ -2,9 +2,9 @@ * * $RCSfile: implbase.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: dbo $ $Date: 2002-06-14 13:20:19 $ + * last change: $Author: dbo $ $Date: 2002-07-10 15:20:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -289,16 +289,12 @@ void WeakComponentImplHelperBase::release() { dispose(); } -#ifdef _DEBUG - catch (Exception & exc) + catch (RuntimeException & exc) // don't break throw () { +#ifdef _DEBUG OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); OSL_ENSURE( 0, msg.getStr() ); - } #endif - catch (...) - { - OSL_ENSURE( 0, "### unexpected non-UNO exception caught!" ); } } OWeakObject::release(); @@ -317,17 +313,20 @@ void WeakComponentImplHelperBase::dispose() lang::EventObject aEvt( static_cast< OWeakObject * >( this ) ); rBHelper.aLC.disposeAndClear( aEvt ); disposing(); + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; } catch (RuntimeException &) { + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; throw; } catch (Exception & exc) { + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; #ifdef _DEBUG @@ -340,6 +339,7 @@ void WeakComponentImplHelperBase::dispose() } catch (...) { + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; OSL_ENSURE( 0, "### unexpected non-UNO exception caught!" ); @@ -354,8 +354,10 @@ void WeakComponentImplHelperBase::addEventListener( Reference< lang::XEventListener > const & xListener ) throw (RuntimeException) { + ClearableMutexGuard aGuard( rBHelper.rMutex ); if (rBHelper.bDisposed || rBHelper.bInDispose) { + aGuard.clear(); lang::EventObject aEvt( static_cast< OWeakObject * >( this ) ); xListener->disposing( aEvt ); } @@ -422,16 +424,12 @@ void WeakAggComponentImplHelperBase::release() { dispose(); } -#ifdef _DEBUG - catch (Exception & exc) + catch (RuntimeException & exc) // don't break throw () { +#ifdef _DEBUG OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); OSL_ENSURE( 0, msg.getStr() ); - } #endif - catch (...) - { - OSL_ENSURE( 0, "### unexpected exception caught!" ); } } OWeakAggObject::release(); @@ -450,17 +448,20 @@ void WeakAggComponentImplHelperBase::dispose() lang::EventObject aEvt( static_cast< OWeakObject * >( this ) ); rBHelper.aLC.disposeAndClear( aEvt ); disposing(); + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; } catch (RuntimeException &) { + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; throw; } catch (Exception & exc) { + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; #ifdef _DEBUG @@ -473,6 +474,7 @@ void WeakAggComponentImplHelperBase::dispose() } catch (...) { + MutexGuard aGuard( rBHelper.rMutex ); rBHelper.bDisposed = sal_True; rBHelper.bInDispose = sal_False; OSL_ENSURE( 0, "### unexpected non-UNO exception caught!" ); @@ -487,8 +489,10 @@ void WeakAggComponentImplHelperBase::addEventListener( Reference< lang::XEventListener > const & xListener ) throw (RuntimeException) { + ClearableMutexGuard aGuard( rBHelper.rMutex ); if (rBHelper.bDisposed || rBHelper.bInDispose) { + aGuard.clear(); lang::EventObject aEvt( static_cast< OWeakObject * >( this ) ); xListener->disposing( aEvt ); } |