cppuhelper/source/gcc3.map | 2 +- cppuhelper/source/weak.cxx | 27 ++++++++------------------- include/unotools/weakref.hxx | 9 +-------- 3 files changed, 10 insertions(+), 28 deletions(-)
New commits: commit 9e8d8870890b0a60ef9acc4c43c67688b58a42a3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Feb 22 14:41:42 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Feb 28 11:25:58 2022 +0100 address review comments for "Add XWeak constructor..." for commit 27352b81638f2f1e792ab48ec532eaacf6f61718 (origin/master, origin/HEAD) Author: Noel Grandin <noel.gran...@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.gran...@collabora.co.uk> 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; } diff --git a/include/unotools/weakref.hxx b/include/unotools/weakref.hxx index ca5682416033..104737404054 100644 --- a/include/unotools/weakref.hxx +++ b/include/unotools/weakref.hxx @@ -77,22 +77,15 @@ public: { } - /** Copy ctor. Initialize this reference with a hard reference. + /** Copy ctor. Initialize this reference with a hard reference. @param rRef another hard ref */ -#if defined LIBO_INTERNAL_ONLY WeakReference(interface_type* pRef) : WeakReferenceHelper( css::uno::Reference<css::uno::XWeak>(static_cast<cppu::OWeakObject*>(pRef))) { } -#else - WeakReference(interface_type* pRef) - : WeakReferenceHelper(static_cast<cppu::OWeakObject*>(pRef)) - { - } -#endif /** Releases this reference and takes over hard reference xInt. If the implementation behind xInt does not support XWeak