diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-19 16:23:42 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-19 16:23:42 +0000 |
commit | ab86e92fa219718c5c172c373e8c7c3d016a2d31 (patch) | |
tree | add491b1759d9107037bfbb0de0305b27094bb8a /cppuhelper/source/weak.cxx | |
parent | 31bf9f8309d6f5283ce08dc92a929cb1a61e8a76 (diff) |
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r-- | cppuhelper/source/weak.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index 973fe3589f24..4278af05ab66 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -2,9 +2,9 @@ * * $RCSfile: weak.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: dbo $ $Date: 2002-11-18 09:59:15 $ + * last change: $Author: hr $ $Date: 2003-03-19 17:23:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -394,20 +394,23 @@ OWeakRefListener::OWeakRefListener() SAL_THROW( () ) } OWeakRefListener::OWeakRefListener(const OWeakRefListener& rRef) SAL_THROW( () ) - : m_aRefCount( 0 ) + : m_aRefCount( 1 ) { try { m_XWeakConnectionPoint = rRef.m_XWeakConnectionPoint; if (m_XWeakConnectionPoint.is()) + { m_XWeakConnectionPoint->addReference((XReference*)this); } + } catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected() + osl_decrementInterlockedCount( &m_aRefCount ); } OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt) SAL_THROW( () ) - : m_aRefCount( 0 ) + : m_aRefCount( 1 ) { try { @@ -424,16 +427,19 @@ OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt) SAL_THRO } } catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected() + osl_decrementInterlockedCount( &m_aRefCount ); } OWeakRefListener::~OWeakRefListener() SAL_THROW( () ) { try { - acquire(); // dont die again if (m_XWeakConnectionPoint.is()) + { + acquire(); // dont die again m_XWeakConnectionPoint->removeReference((XReference*)this); } + } catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected() } |