summaryrefslogtreecommitdiff
path: root/cppuhelper/source/weak.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-13 17:55:09 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-13 17:55:09 +0100
commitbf46dbcd552d7538474af43b82eb16e17e02d0a4 (patch)
treeac7e8c73413e05498ecc35ed071a9d4d517d8391 /cppuhelper/source/weak.cxx
parentbb94dd8918d401094768173d99ecf5a6efeb6739 (diff)
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.
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r--cppuhelper/source/weak.cxx45
1 files changed, 21 insertions, 24 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index 1901610d40b7..1fbfb3fa96ad 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -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( () )