summaryrefslogtreecommitdiff
path: root/cppuhelper/source/weak.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r--cppuhelper/source/weak.cxx34
1 files changed, 20 insertions, 14 deletions
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) )
{
}