summaryrefslogtreecommitdiff
path: root/cppuhelper/source/implbase.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/source/implbase.cxx')
-rw-r--r--cppuhelper/source/implbase.cxx84
1 files changed, 36 insertions, 48 deletions
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
index f133725059bf..b02a48ab06de 100644
--- a/cppuhelper/source/implbase.cxx
+++ b/cppuhelper/source/implbase.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: implbase.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: vg $ $Date: 2003-04-15 16:34:42 $
+ * last change: $Author: vg $ $Date: 2003-07-11 10:41:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -337,43 +337,37 @@ void WeakComponentImplHelperBase::dispose()
aGuard.clear();
try
{
+ // side effect: keeping a reference to this
lang::EventObject aEvt( static_cast< OWeakObject * >( this ) );
- rBHelper.aLC.disposeAndClear( aEvt );
- disposing();
+ try
+ {
+ rBHelper.aLC.disposeAndClear( aEvt );
+ disposing();
+ }
+ catch (...)
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ throw;
+ }
MutexGuard aGuard( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
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;
-#if OSL_DEBUG_LEVEL > 0
- OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE( 0, msg.getStr() );
-#endif
throw RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected UNO exception caught: ") ) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected UNO exception caught: ") ) +
exc.Message, Reference< XInterface >() );
}
- catch (...)
- {
- MutexGuard aGuard( rBHelper.rMutex );
- rBHelper.bDisposed = sal_True;
- rBHelper.bInDispose = sal_False;
- OSL_ENSURE( 0, "### unexpected non-UNO exception caught!" );
- throw RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected non-UNO exception caught!") ),
- Reference< XInterface >() );
- }
}
}
//__________________________________________________________________________________________________
@@ -472,43 +466,37 @@ void WeakAggComponentImplHelperBase::dispose()
aGuard.clear();
try
{
+ // side effect: keeping a reference to this
lang::EventObject aEvt( static_cast< OWeakObject * >( this ) );
- rBHelper.aLC.disposeAndClear( aEvt );
- disposing();
+ try
+ {
+ rBHelper.aLC.disposeAndClear( aEvt );
+ disposing();
+ }
+ catch (...)
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ throw;
+ }
MutexGuard aGuard( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
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;
-#if OSL_DEBUG_LEVEL > 0
- OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE( 0, msg.getStr() );
-#endif
throw RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected UNO exception caught: ") ) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected UNO exception caught: ") ) +
exc.Message, Reference< XInterface >() );
}
- catch (...)
- {
- MutexGuard aGuard( rBHelper.rMutex );
- rBHelper.bDisposed = sal_True;
- rBHelper.bInDispose = sal_False;
- OSL_ENSURE( 0, "### unexpected non-UNO exception caught!" );
- throw RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected non-UNO exception caught!") ),
- Reference< XInterface >() );
- }
}
}
//__________________________________________________________________________________________________