summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2006-03-06 09:11:02 +0000
committerRüdiger Timm <rt@openoffice.org>2006-03-06 09:11:02 +0000
commit198646715b2f0f2809717be288430f11a657dfa8 (patch)
tree861b5e3d26f625919cb054b225d00eb1011abfda /cppuhelper
parentf05ab1a5936938bf44173f6468b45e188a7ff077 (diff)
INTEGRATION: CWS dbo510 (1.15.14); FILE MERGED
2005/11/21 15:33:46 dbo 1.15.14.1: #i58248# fixing Weak[Agg]ComponentImplHelperBase::release(), documenting OWeakObject::release()
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/implbase.cxx65
1 files changed, 36 insertions, 29 deletions
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
index 365f0d320d35..bc06d526cd2c 100644
--- a/cppuhelper/source/implbase.cxx
+++ b/cppuhelper/source/implbase.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: implbase.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 09:26:31 $
+ * last change: $Author: rt $ $Date: 2006-03-06 10:11:02 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -258,21 +258,23 @@ void WeakComponentImplHelperBase::acquire()
void WeakComponentImplHelperBase::release()
throw ()
{
- if (1 == m_refCount && !rBHelper.bDisposed)
- {
- try
- {
- dispose();
- }
- catch (RuntimeException & exc) // don't break throw ()
- {
-#if OSL_DEBUG_LEVEL > 0
- OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE( 0, msg.getStr() );
-#endif
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if (! rBHelper.bDisposed) {
+ try {
+ dispose();
+ }
+ catch (RuntimeException const& exc) { // don't break throw ()
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ OSL_ASSERT( rBHelper.bDisposed );
}
+ OWeakObject::release();
}
- OWeakObject::release();
}
//__________________________________________________________________________________________________
void WeakComponentImplHelperBase::dispose()
@@ -386,22 +388,27 @@ void WeakAggComponentImplHelperBase::acquire()
void WeakAggComponentImplHelperBase::release()
throw ()
{
- Reference< XInterface > x( xDelegator );
- if (!x.is() && 1 == m_refCount && !rBHelper.bDisposed)
- {
- try
- {
- dispose();
- }
- catch (RuntimeException & exc) // don't break throw ()
- {
-#if OSL_DEBUG_LEVEL > 0
- OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE( 0, msg.getStr() );
-#endif
+ Reference<XInterface> const xDelegator_(xDelegator);
+ if (xDelegator_.is()) {
+ OWeakAggObject::release();
+ }
+ else if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if (! rBHelper.bDisposed) {
+ try {
+ dispose();
+ }
+ catch (RuntimeException const& exc) { // don't break throw ()
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ OSL_ASSERT( rBHelper.bDisposed );
}
+ OWeakAggObject::release();
}
- OWeakAggObject::release();
}
//__________________________________________________________________________________________________
void WeakAggComponentImplHelperBase::dispose()