summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-02 14:53:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-06 07:01:51 +0000
commit7d1b01070c330d45212cd69ea692b2263c23c2a6 (patch)
tree7ae6ecdd69cd3d8b6ce4431a39034186695497c0 /ucb
parent9f138ffe9da2f448a455f4b51facab82e5e243d7 (diff)
remove some manual ref counting in svx and xmloff
Change-Id: Ica0b6ff8ff7fa9e65cd758160d6e3ea7110ebb46 Reviewed-on: https://gerrit.libreoffice.org/25824 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/core/ucbstore.cxx25
-rw-r--r--ucb/source/sorter/sortresult.cxx9
-rw-r--r--ucb/source/sorter/sortresult.hxx3
3 files changed, 14 insertions, 23 deletions
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index 96ba17f5726a..6e020edbb07e 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -28,6 +28,7 @@
#include <unordered_map>
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
+#include <rtl/ref.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/interfacecontainer2.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -1063,8 +1064,8 @@ typedef OMultiTypeInterfaceContainerHelperVar<OUString> PropertyListeners_Impl;
struct PersistentPropertySet_Impl
{
- PropertySetRegistry* m_pCreator;
- PropertySetInfo_Impl* m_pInfo;
+ rtl::Reference<PropertySetRegistry> m_pCreator;
+ rtl::Reference<PropertySetInfo_Impl> m_pInfo;
OUString m_aKey;
OUString m_aFullKey;
osl::Mutex m_aMutex;
@@ -1078,16 +1079,10 @@ struct PersistentPropertySet_Impl
m_pDisposeEventListeners( nullptr ), m_pPropSetChangeListeners( nullptr ),
m_pPropertyChangeListeners( nullptr )
{
- m_pCreator->acquire();
}
~PersistentPropertySet_Impl()
{
- m_pCreator->release();
-
- if ( m_pInfo )
- m_pInfo->release();
-
delete m_pDisposeEventListeners;
delete m_pPropSetChangeListeners;
delete m_pPropertyChangeListeners;
@@ -1189,13 +1184,11 @@ Reference< XPropertySetInfo > SAL_CALL PersistentPropertySet::getPropertySetInfo
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
- PropertySetInfo_Impl*& rpInfo = m_pImpl->m_pInfo;
- if ( !rpInfo )
+ if ( !m_pImpl->m_pInfo.is() )
{
- rpInfo = new PropertySetInfo_Impl( this );
- rpInfo->acquire();
+ m_pImpl->m_pInfo = new PropertySetInfo_Impl( this );
}
- return Reference< XPropertySetInfo >( rpInfo );
+ return Reference< XPropertySetInfo >( m_pImpl->m_pInfo.get() );
}
@@ -1410,7 +1403,7 @@ void SAL_CALL PersistentPropertySet::removeVetoableChangeListener(
Reference< XPropertySetRegistry > SAL_CALL PersistentPropertySet::getRegistry()
throw( RuntimeException, std::exception )
{
- return Reference< XPropertySetRegistry >( m_pImpl->m_pCreator );
+ return Reference< XPropertySetRegistry >( m_pImpl->m_pCreator.get() );
}
@@ -1549,7 +1542,7 @@ void SAL_CALL PersistentPropertySet::addProperty(
xBatch->commitChanges();
// Property set info is invalid.
- if ( m_pImpl->m_pInfo )
+ if ( m_pImpl->m_pInfo.is() )
m_pImpl->m_pInfo->reset();
// Notify propertyset info change listeners.
@@ -1717,7 +1710,7 @@ void SAL_CALL PersistentPropertySet::removeProperty( const OUString& Name )
xBatch->commitChanges();
// Property set info is invalid.
- if ( m_pImpl->m_pInfo )
+ if ( m_pImpl->m_pInfo.is() )
m_pImpl->m_pInfo->reset();
// Notify propertyset info change listeners.
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index 95d9c9728d97..4931621581f5 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -124,7 +124,6 @@ SortedResultSet::SortedResultSet( Reference< XResultSet > aResult )
mpDisposeEventListeners = nullptr;
mpPropChangeListeners = nullptr;
mpVetoChangeListeners = nullptr;
- mpPropSetInfo = nullptr;
mxOriginal = aResult;
mpSortInfo = nullptr;
@@ -153,8 +152,7 @@ SortedResultSet::~SortedResultSet()
mpSortInfo = nullptr;
- if ( mpPropSetInfo )
- mpPropSetInfo->release();
+ mpPropSetInfo.clear();
delete mpPropChangeListeners;
delete mpVetoChangeListeners;
@@ -830,13 +828,12 @@ SortedResultSet::getPropertySetInfo() throw( RuntimeException, std::exception )
{
osl::Guard< osl::Mutex > aGuard( maMutex );
- if ( !mpPropSetInfo )
+ if ( !mpPropSetInfo.is() )
{
mpPropSetInfo = new SRSPropertySetInfo();
- mpPropSetInfo->acquire();
}
- return Reference< XPropertySetInfo >( mpPropSetInfo );
+ return Reference< XPropertySetInfo >( mpPropSetInfo.get() );
}
diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx
index 9ee45c55a245..21a5fe6e6671 100644
--- a/ucb/source/sorter/sortresult.hxx
+++ b/ucb/source/sorter/sortresult.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
#include <com/sun/star/ucb/ListAction.hpp>
#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
#include <deque>
namespace comphelper {
@@ -126,7 +127,7 @@ class SortedResultSet: public cppu::WeakImplHelper <
css::uno::Reference < css::sdbc::XResultSet > mxOriginal;
css::uno::Reference < css::sdbc::XResultSet > mxOther;
- SRSPropertySetInfo* mpPropSetInfo;
+ rtl::Reference<SRSPropertySetInfo> mpPropSetInfo;
SortInfo* mpSortInfo;
osl::Mutex maMutex;
SortedEntryList maS2O; // maps the sorted entries to the original ones