summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2006-03-06 09:11:16 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2006-03-06 09:11:16 +0000
commitb88d12c01bb68105a2f3dd7aaa8b9ab252a06c49 (patch)
treea92acc1b7f41adfe3ef5e8a745ff76a0848e253b /cppuhelper
parent198646715b2f0f2809717be288430f11a657dfa8 (diff)
INTEGRATION: CWS dbo510 (1.9.14); FILE MERGED
2005/11/21 15:33:46 dbo 1.9.14.1: #i58248# fixing Weak[Agg]ComponentImplHelperBase::release(), documenting OWeakObject::release()
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/weak.cxx52
1 files changed, 17 insertions, 35 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index 341905379144..dd67b76cd3c7 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: weak.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 09:31:08 $
+ * last change: $Author: rt $ $Date: 2006-03-06 10:11:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -49,33 +49,6 @@ using namespace com::sun::star::uno;
namespace cppu
{
-/**
- The mutex to synchronize the the queryAdapted call throug the connection point
- with the release call at the weak object.
- */
-/*
-struct WeakMutexStatic
-{
- Mutex aMutex;
- sal_Bool bDestructed;
-
- WeakMutexStatic()
- : bDestructed( sal_False )
- {}
- ~WeakMutexStatic()
- { bDestructed = sal_True; }
-};
-
-inline static Mutex & getWeakMutex() throw()
-{
- static WeakMutexStatic s_wmstatic;
- if (s_wmstatic.bDestructed)
- return *Mutex::getGlobalMutex();
- else
- return s_wmstatic.aMutex;
-}
-*/
-
// due to static Reflection destruction from usr, ther must be a mutex leak (#73272#)
inline static Mutex & getWeakMutex() SAL_THROW( () )
{
@@ -222,15 +195,24 @@ void SAL_CALL OWeakObject::acquire() throw()
// XInterface
void SAL_CALL OWeakObject::release() throw()
{
- if (osl_decrementInterlockedCount( &m_refCount ) == 0)
- {
- if (m_pWeakConnectionPoint)
- {
- OWeakConnectionPoint * p = m_pWeakConnectionPoint;
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // notify/clear all weak-refs before object's dtor is executed
+ // (which may check weak-refs to this object):
+ if (m_pWeakConnectionPoint != 0) {
+ OWeakConnectionPoint * const p = m_pWeakConnectionPoint;
m_pWeakConnectionPoint = 0;
- p->dispose();
+ try {
+ p->dispose();
+ }
+ catch (RuntimeException const& exc) {
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
p->release();
}
+ // destroy object:
delete this;
}
}