swunolocking1: #i108161#: WeakReferenceHelper:

Apple g++ 4.0.1 erroneously believes that it is ambiguous to use
 WeakReference<XInterface>::operator=(Reference<XInterface>).
 as a workaround, introduce WeakReferenceHelper::clear(), and fix all users.
This commit is contained in:
Michael Stahl
2010-01-13 17:55:09 +01:00
parent bb94dd8918
commit bf46dbcd55
5 changed files with 30 additions and 24 deletions

View File

@@ -109,6 +109,12 @@ 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;

View File

@@ -384,4 +384,5 @@ UDK_3.7 { # OOo 3.3
global:
__1cEcppuLOWeakObjectbAdisposeWeakConnectionPoint6M_v_;
__1cDcomDsunEstarDunoTWeakReferenceHelper2G6Mrkn0DJReference4n0DKXInterface____r4_;
__1cDcomDsunEstarDunoTWeakReferenceHelperFclear6M_v_;
} UDK_3.6;

View File

@@ -378,5 +378,6 @@ UDK_3.6 { # OOo 3.3
global:
_ZN4cppu11OWeakObject26disposeWeakConnectionPointEv;
_ZN3com3sun4star3uno19WeakReferenceHelperaSERKNS2_9ReferenceINS2_10XInterfaceEEE;
_ZN3com3sun4star3uno19WeakReferenceHelper5clearEv;
} UDK_3.5;

View File

@@ -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;

View File

@@ -479,6 +479,25 @@ WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef) SA
}
}
void WeakReferenceHelper::clear() SAL_THROW( () )
{
try
{
if (m_pImpl)
{
if (m_pImpl->m_XWeakConnectionPoint.is())
{
m_pImpl->m_XWeakConnectionPoint->removeReference(
(XReference*)m_pImpl);
m_pImpl->m_XWeakConnectionPoint.clear();
}
m_pImpl->release();
m_pImpl = 0;
}
}
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
}
WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () )
{
if (this == &rWeakRef)
@@ -495,16 +514,7 @@ SAL_THROW( () )
{
try
{
if (m_pImpl)
{
if (m_pImpl->m_XWeakConnectionPoint.is())
{
m_pImpl->m_XWeakConnectionPoint->removeReference((XReference*)m_pImpl);
m_pImpl->m_XWeakConnectionPoint.clear();
}
m_pImpl->release();
m_pImpl = 0;
}
clear();
if (xInt.is())
{
m_pImpl = new OWeakRefListener(xInt);
@@ -517,20 +527,7 @@ SAL_THROW( () )
WeakReferenceHelper::~WeakReferenceHelper() SAL_THROW( () )
{
try
{
if (m_pImpl)
{
if (m_pImpl->m_XWeakConnectionPoint.is())
{
m_pImpl->m_XWeakConnectionPoint->removeReference((XReference*)m_pImpl);
m_pImpl->m_XWeakConnectionPoint.clear();
}
m_pImpl->release();
m_pImpl = 0; // for safety
}
}
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
clear();
}
Reference< XInterface > WeakReferenceHelper::get() const SAL_THROW( () )