summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-12-02 13:40:39 +0100
committerMathias Bauer <mba@openoffice.org>2009-12-02 13:40:39 +0100
commita100bbbe1ff6e129bd5c76c37c41f1dd34bf849e (patch)
treeb7c954c287f8e330bbbcf84188281df41032194a /cppuhelper
parentc4bc00d649859bbde1bf1c98c4939e43796dd471 (diff)
parentc57366aeed6aa03e635d2d793a82e35a62028920 (diff)
merge with db33a
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/inc/cppuhelper/weak.hxx6
-rwxr-xr-xcppuhelper/source/cc5_solaris_sparc.map5
-rw-r--r--cppuhelper/source/component.cxx4
-rw-r--r--cppuhelper/source/gcc3.map6
-rw-r--r--cppuhelper/source/implbase.cxx4
-rw-r--r--cppuhelper/source/msvc_win32_intel.map5
-rw-r--r--cppuhelper/source/weak.cxx34
7 files changed, 50 insertions, 14 deletions
diff --git a/cppuhelper/inc/cppuhelper/weak.hxx b/cppuhelper/inc/cppuhelper/weak.hxx
index f4b9c38d2215..9072ba6f6240 100644
--- a/cppuhelper/inc/cppuhelper/weak.hxx
+++ b/cppuhelper/inc/cppuhelper/weak.hxx
@@ -67,6 +67,12 @@ protected:
*/
virtual ~OWeakObject() SAL_THROW( (::com::sun::star::uno::RuntimeException) );
+ /** disposes and resets m_pWeakConnectionPoint
+ @precond
+ m_refCount equals 0
+ */
+ void disposeWeakConnectionPoint();
+
/** reference count.
@attention
diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map
index 0c3f1c556d64..0961c6830d1f 100755
--- a/cppuhelper/source/cc5_solaris_sparc.map
+++ b/cppuhelper/source/cc5_solaris_sparc.map
@@ -379,3 +379,8 @@ UDK_3.6 { # OOo 3.0
__1cEcppuSOPropertySetHelper2t5B6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType___pn0AWIEventNotificationHook_b_v_;
__1cEcppuSOPropertySetHelper2t6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType___pn0AWIEventNotificationHook_b_v_;
} UDK_3.5;
+
+UDK_3.7 { # OOo 3.3
+ global:
+ __1cEcppuLOWeakObjectbAdisposeWeakConnectionPoint6M_v_;
+} UDK_3.6;
diff --git a/cppuhelper/source/component.cxx b/cppuhelper/source/component.cxx
index d94614703be5..728f6815c309 100644
--- a/cppuhelper/source/component.cxx
+++ b/cppuhelper/source/component.cxx
@@ -90,6 +90,10 @@ void OComponentHelper::release() throw()
{
if (! rBHelper.bDisposed)
{
+ // *before* again incrementing our ref count, ensure that our weak connection point
+ // will not create references to us anymore (via XAdapter::queryAdapted)
+ disposeWeakConnectionPoint();
+
Reference<XInterface > xHoldAlive( *this );
// First dispose
try
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 819c3e046b30..9348e91525c0 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -373,3 +373,9 @@ UDK_3.5 { # OOo 3.0
_ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEPNS_22IEventNotificationHookEb;
_ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEPNS_22IEventNotificationHookEb;
} UDK_3.4;
+
+UDK_3.6 { # OOo 3.3
+ global:
+ _ZN4cppu11OWeakObject26disposeWeakConnectionPointEv;
+} UDK_3.5;
+
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
index 9caa4ca93615..acf05724c71b 100644
--- a/cppuhelper/source/implbase.cxx
+++ b/cppuhelper/source/implbase.cxx
@@ -247,6 +247,8 @@ void WeakComponentImplHelperBase::release()
throw ()
{
if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // ensure no other references are created, via the weak connection point, from now on
+ disposeWeakConnectionPoint();
// restore reference count:
osl_incrementInterlockedCount( &m_refCount );
if (! rBHelper.bDisposed) {
@@ -381,6 +383,8 @@ void WeakAggComponentImplHelperBase::release()
OWeakAggObject::release();
}
else if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // ensure no other references are created, via the weak connection point, from now on
+ disposeWeakConnectionPoint();
// restore reference count:
osl_incrementInterlockedCount( &m_refCount );
if (! rBHelper.bDisposed) {
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index a90ec88f3ca3..c999ae200ac2 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -271,3 +271,8 @@ UDK_3.5 { # OOo 3.0
global:
??0OPropertySetHelper@cppu@@QAE@AAU?$OBroadcastHelperVar@VOMultiTypeInterfaceContainerHelper@cppu@@VType@uno@star@sun@com@@@1@PAVIEventNotificationHook@1@_N@Z;
} UDK_3.4;
+
+UDK_3.6 { # OOo 3.3
+ global:
+ ?disposeWeakConnectionPoint@OWeakObject@cppu@@IAEXXZ;
+} UDK_3.5;
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index c4055eba4f8a..b518d2526e3b 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -216,25 +216,31 @@ void SAL_CALL OWeakObject::release() throw()
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;
- try {
- p->dispose();
- }
- catch (RuntimeException const& exc) {
- OSL_ENSURE(
- false, OUStringToOString(
- exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
- static_cast<void>(exc);
- }
- p->release();
- }
+ disposeWeakConnectionPoint();
// destroy object:
delete this;
}
}
+void OWeakObject::disposeWeakConnectionPoint()
+{
+ OSL_PRECOND( m_refCount == 0, "OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" );
+ if (m_pWeakConnectionPoint != 0) {
+ OWeakConnectionPoint * const p = m_pWeakConnectionPoint;
+ m_pWeakConnectionPoint = 0;
+ try {
+ p->dispose();
+ }
+ catch (RuntimeException const& exc) {
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ p->release();
+ }
+}
+
OWeakObject::~OWeakObject() SAL_THROW( (RuntimeException) )
{
}