summaryrefslogtreecommitdiff
path: root/cppuhelper/source/weak.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r--cppuhelper/source/weak.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index 446cdc0e43ba..07fe1cbad359 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -254,16 +254,12 @@ OWeakObject::~OWeakObject() COVERITY_NOEXCEPT_FALSE
// XWeak
Reference< XAdapter > SAL_CALL OWeakObject::queryAdapter()
{
- if (!m_pWeakConnectionPoint)
+ std::scoped_lock aGuard( *gpWeakMutex );
+ if( !m_pWeakConnectionPoint )
{
- // only acquire mutex if member is not created
- std::scoped_lock aGuard( *gpWeakMutex );
- if( !m_pWeakConnectionPoint )
- {
- OWeakConnectionPoint * p = new OWeakConnectionPoint(this);
- p->acquire();
- m_pWeakConnectionPoint = p;
- }
+ OWeakConnectionPoint * p = new OWeakConnectionPoint(this);
+ p->acquire();
+ m_pWeakConnectionPoint = p;
}
return m_pWeakConnectionPoint;