summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-22 14:41:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-28 11:25:58 +0100
commit9e8d8870890b0a60ef9acc4c43c67688b58a42a3 (patch)
tree9d7acba07d89c3ae9de7b55b16ba4411adb0601d /cppuhelper/source
parent3e23161baf5a529d1006b320e9044e436827c764 (diff)
address review comments for "Add XWeak constructor..."
for commit 27352b81638f2f1e792ab48ec532eaacf6f61718 (origin/master, origin/HEAD) Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Mon Feb 21 16:00:52 2022 +0200 Add XWeak constructor and operator= to uno::WeakReference I accidentally created a new gerrit change for this, and thus managed to miss sorting out various review comments. (*) Fix version number in gcc3.map (*) Narrow the interface (i.e. assume non-null parameter) in WeakReferenceHelper (*) Remove cargo-cult catch and OSL_ASSERT in WeakReferenceHelper (*) Remove accidental indentation Change-Id: I8d1b22dd42216e9293959032d92df65405fb054c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130349 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/gcc3.map2
-rw-r--r--cppuhelper/source/weak.cxx27
2 files changed, 9 insertions, 20 deletions
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 07099853afb7..2af95d60a7e1 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -435,7 +435,7 @@ global:
_ZN3com3sun4star3uno19WeakReferenceHelperaSEOS3_; # com::sun::star::uno::WeakReferenceHelper::operator=(com::sun::star::uno::WeakReferenceHelper&&)
} LIBO_UDK_3.9;
-LIBO_UDK_7.5 { # LibO 7.5
+LIBO_UDK_7.4 { # LibO 7.4
global:
_ZN3com3sun4star3uno19WeakReferenceHelperaSERKNS2_9ReferenceINS2_5XWeakEEE; # com::sun::star::uno::WeakReferenceHelper::operator=(com::sun::star::uno::Reference<com::sun::star::uno::XWeak> const&)
_ZN3com3sun4star3uno19WeakReferenceHelperC1ERKNS2_9ReferenceINS2_5XWeakEEE; # com::sun::star::uno::WeakReferenceHelper::WeakReferenceHelper(com::sun::star::uno::Reference<com::sun::star::uno::XWeak> const&)
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index 65c9e7f81912..e51f9ccf86a6 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -376,19 +376,12 @@ OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt)
OWeakRefListener::OWeakRefListener(const Reference< XWeak >& xWeak)
: m_aRefCount( 1 )
{
- try
- {
- if (xWeak.is())
- {
- m_XWeakConnectionPoint = xWeak->queryAdapter();
+ m_XWeakConnectionPoint = xWeak->queryAdapter();
- if (m_XWeakConnectionPoint.is())
- {
- m_XWeakConnectionPoint->addReference(static_cast<XReference*>(this));
- }
- }
+ if (m_XWeakConnectionPoint.is())
+ {
+ m_XWeakConnectionPoint->addReference(static_cast<XReference*>(this));
}
- catch (RuntimeException &) { OSL_ASSERT( false ); } // assert here, but no unexpected()
osl_atomic_decrement( &m_aRefCount );
}
@@ -526,16 +519,12 @@ WeakReferenceHelper::operator= (const Reference< XInterface > & xInt)
WeakReferenceHelper &
WeakReferenceHelper::operator= (const Reference< XWeak > & xWeak)
{
- try
+ clear();
+ if (xWeak)
{
- clear();
- if (xWeak.is())
- {
- m_pImpl = new OWeakRefListener(xWeak);
- m_pImpl->acquire();
- }
+ m_pImpl = new OWeakRefListener(xWeak);
+ m_pImpl->acquire();
}
- catch (RuntimeException &) { OSL_ASSERT( false ); } // assert here, but no unexpected()
return *this;
}