summaryrefslogtreecommitdiff
path: root/cppuhelper/source/weak.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-08 22:22:08 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-08 22:22:08 +0100
commit0aab9a48358f905de8d65568e5f32e8d36d6021c (patch)
tree14ec4d8eff21f287375e79604e198adf4df388b9 /cppuhelper/source/weak.cxx
parentd89afea42e33bb771cd9a31fbdc71b94ba4d8679 (diff)
swunolocking1: #i108161#: WeakReferenceHelper::operator=():
avoid creating a temporary WeakReferenceHelper for uno::Reference assignment. [according to callgrind this is 3 times faster]
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r--cppuhelper/source/weak.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index b518d2526e3b..1901610d40b7 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -481,11 +481,20 @@ WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef) SA
WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () )
{
- try
+ if (this == &rWeakRef)
{
- if (this != &rWeakRef)
+ return *this;
+ }
+ Reference< XInterface > xInt( rWeakRef.get() );
+ return operator = ( xInt );
+}
+
+WeakReferenceHelper & SAL_CALL
+WeakReferenceHelper::operator= (const Reference< XInterface > & xInt)
+SAL_THROW( () )
+{
+ try
{
- Reference< XInterface > xInt( rWeakRef.get() );
if (m_pImpl)
{
if (m_pImpl->m_XWeakConnectionPoint.is())
@@ -502,7 +511,6 @@ WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& r
m_pImpl->acquire();
}
}
- }
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
return *this;
}