diff options
author | sb <sb@openoffice.org> | 2010-02-08 09:18:14 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-02-08 09:18:14 +0100 |
commit | 67c91ff80984de9699bf60a58a10b6423c8ad4db (patch) | |
tree | b41a323e86cf6c0dbe7b4cb890c311d91249732e /cppuhelper | |
parent | 88214f635241cf2ef901ce97d7e732cbb061a9b6 (diff) | |
parent | 969ab37d036dbd302a5da9f7510ada8854facfcd (diff) |
sb118: merged in DEV300_m71
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/inc/cppuhelper/weakref.hxx | 39 | ||||
-rwxr-xr-x | cppuhelper/source/cc5_solaris_sparc.map | 2 | ||||
-rw-r--r-- | cppuhelper/source/gcc3.map | 2 | ||||
-rw-r--r-- | cppuhelper/source/msvc_win32_intel.map | 1 | ||||
-rw-r--r-- | cppuhelper/source/weak.cxx | 47 |
5 files changed, 61 insertions, 30 deletions
diff --git a/cppuhelper/inc/cppuhelper/weakref.hxx b/cppuhelper/inc/cppuhelper/weakref.hxx index ba4174db9..9eb1c9adc 100644 --- a/cppuhelper/inc/cppuhelper/weakref.hxx +++ b/cppuhelper/inc/cppuhelper/weakref.hxx @@ -78,15 +78,17 @@ public: @param rWeakRef another weak ref */ WeakReferenceHelper & SAL_CALL operator = ( const WeakReferenceHelper & rWeakRef ) SAL_THROW( () ); - - /** Releases this reference and takes over hard reference xInt. If the implementation behind - xInt does not support XWeak or XInt is null, than this reference is null. - + + /** Releases this reference and takes over hard reference xInt. + If the implementation behind xInt does not support XWeak + or XInt is null, then this reference is null. + @param xInt another hard reference */ - inline WeakReferenceHelper & SAL_CALL operator = ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xInt ) SAL_THROW( () ) - { return operator = ( WeakReferenceHelper( xInt ) ); } - + WeakReferenceHelper & SAL_CALL operator = ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > & xInt ) SAL_THROW( () ); + /** Returns true if both weak refs reference to the same object. @param rObj another weak ref @@ -106,7 +108,13 @@ public: */ inline SAL_CALL operator Reference< XInterface > () const SAL_THROW( () ) { return get(); } - + + /** Releases this reference. + + @since UDK 3.2.12 + */ + void SAL_CALL clear() SAL_THROW( () ); + protected: /** @internal */ OWeakRefListener * m_pImpl; @@ -134,7 +142,20 @@ public: inline WeakReference( const Reference< interface_type > & rRef ) SAL_THROW( () ) : WeakReferenceHelper( rRef ) {} - + + /** Releases this reference and takes over hard reference xInt. + If the implementation behind xInt does not support XWeak + or XInt is null, then this reference is null. + + @param xInt another hard reference + + @since UDK 3.2.12 + */ + WeakReference & SAL_CALL operator = ( + const ::com::sun::star::uno::Reference< interface_type > & xInt ) + SAL_THROW( () ) + { WeakReferenceHelper::operator=(xInt); return *this; } + /** Gets a hard reference to the object. @return hard reference or null, if the weakly referenced interface has gone diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map index ff21cae7a..190bdcef4 100755 --- a/cppuhelper/source/cc5_solaris_sparc.map +++ b/cppuhelper/source/cc5_solaris_sparc.map @@ -383,4 +383,6 @@ UDK_3.6 { # OOo 3.0 UDK_3.7 { # OOo 3.3 global: __1cEcppuLOWeakObjectbAdisposeWeakConnectionPoint6M_v_; + __1cDcomDsunEstarDunoTWeakReferenceHelper2G6Mrkn0DJReference4n0DKXInterface____r4_; + __1cDcomDsunEstarDunoTWeakReferenceHelperFclear6M_v_; } UDK_3.6; diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index 0cec45b6e..16a92f820 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -377,5 +377,7 @@ UDK_3.5 { # OOo 3.0 UDK_3.6 { # OOo 3.3 global: _ZN4cppu11OWeakObject26disposeWeakConnectionPointEv; + _ZN3com3sun4star3uno19WeakReferenceHelperaSERKNS2_9ReferenceINS2_10XInterfaceEEE; + _ZN3com3sun4star3uno19WeakReferenceHelper5clearEv; } UDK_3.5; diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map index c999ae200..6bc10cb17 100644 --- a/cppuhelper/source/msvc_win32_intel.map +++ b/cppuhelper/source/msvc_win32_intel.map @@ -275,4 +275,5 @@ UDK_3.5 { # OOo 3.0 UDK_3.6 { # OOo 3.3 global: ?disposeWeakConnectionPoint@OWeakObject@cppu@@IAEXXZ; + ?clear@WeakReferenceHelper@uno@star@sun@com@@QAAXXZ; } UDK_3.5; diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index 2cd092cb8..dd05a4c6e 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -479,50 +479,55 @@ WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef) SA } } -WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () ) +void WeakReferenceHelper::clear() SAL_THROW( () ) { try { - if (this != &rWeakRef) - { - Reference< XInterface > xInt( rWeakRef.get() ); if (m_pImpl) { if (m_pImpl->m_XWeakConnectionPoint.is()) { - m_pImpl->m_XWeakConnectionPoint->removeReference((XReference*)m_pImpl); + m_pImpl->m_XWeakConnectionPoint->removeReference( + (XReference*)m_pImpl); m_pImpl->m_XWeakConnectionPoint.clear(); } m_pImpl->release(); m_pImpl = 0; } - if (xInt.is()) - { - m_pImpl = new OWeakRefListener(xInt); - m_pImpl->acquire(); - } - } } catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected() - return *this; } -WeakReferenceHelper::~WeakReferenceHelper() SAL_THROW( () ) +WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () ) { - try + if (this == &rWeakRef) { - if (m_pImpl) + return *this; + } + Reference< XInterface > xInt( rWeakRef.get() ); + return operator = ( xInt ); +} + +WeakReferenceHelper & SAL_CALL +WeakReferenceHelper::operator= (const Reference< XInterface > & xInt) +SAL_THROW( () ) +{ + try { - if (m_pImpl->m_XWeakConnectionPoint.is()) + clear(); + if (xInt.is()) { - m_pImpl->m_XWeakConnectionPoint->removeReference((XReference*)m_pImpl); - m_pImpl->m_XWeakConnectionPoint.clear(); + m_pImpl = new OWeakRefListener(xInt); + m_pImpl->acquire(); } - m_pImpl->release(); - m_pImpl = 0; // for safety - } } catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected() + return *this; +} + +WeakReferenceHelper::~WeakReferenceHelper() SAL_THROW( () ) +{ + clear(); } Reference< XInterface > WeakReferenceHelper::get() const SAL_THROW( () ) |