summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-05-03 15:09:55 +0200
committerDavid Tardon <dtardon@redhat.com>2016-05-03 15:34:09 +0200
commit46410f7e5b79cf42aa52d7a81fe4608c34601ce6 (patch)
tree506fed1b52ea1f009533f001d11c2551b541591c /filter
parent750935fddb07650967066e00b663f0ab79f820b6 (diff)
use unique_ptr
Change-Id: I28615a645e6e4763bb03362a90da93a818985a78
Diffstat (limited to 'filter')
-rw-r--r--filter/source/config/cache/basecontainer.cxx7
-rw-r--r--filter/source/config/cache/basecontainer.hxx4
-rw-r--r--filter/source/config/cache/filtercache.cxx8
-rw-r--r--filter/source/config/cache/filtercache.hxx7
4 files changed, 14 insertions, 12 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx
index 0049b43636b5..2c193f36c055 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -36,7 +36,7 @@ namespace filter{
BaseContainer::BaseContainer()
: BaseLock ( )
- , m_pFlushCache(nullptr )
+ , m_pFlushCache()
, m_eType()
, m_lListener (m_aLock)
{
@@ -120,7 +120,7 @@ FilterCache* BaseContainer::impl_getWorkingCache() const
// SAFE ->
::osl::ResettableMutexGuard aLock(m_aLock);
if (m_pFlushCache)
- return m_pFlushCache;
+ return m_pFlushCache.get();
else
return &TheFilterCache::get();
// <- SAFE
@@ -471,8 +471,7 @@ void SAL_CALL BaseContainer::flush()
css::uno::makeAny(ex));
}
- delete m_pFlushCache;
- m_pFlushCache = nullptr;
+ m_pFlushCache.reset();
css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster = m_xRefreshBroadcaster;
diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx
index 9c0f9246eba4..95589b2b9abb 100644
--- a/filter/source/config/cache/basecontainer.hxx
+++ b/filter/source/config/cache/basecontainer.hxx
@@ -19,6 +19,8 @@
#ifndef INCLUDED_FILTER_SOURCE_CONFIG_CACHE_BASECONTAINER_HXX
#define INCLUDED_FILTER_SOURCE_CONFIG_CACHE_BASECONTAINER_HXX
+#include <memory>
+
#include "filtercache.hxx"
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -87,7 +89,7 @@ class BaseContainer : public BaseLock
m_rCache listen on the global configuration, where m_pFlushCache
write its data. m_rCache update itself automatically.
*/
- FilterCache* m_pFlushCache;
+ std::unique_ptr<FilterCache> m_pFlushCache;
/** @short specify, which sub container of the used filter cache
must be wrapped by this container interface. */
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 3da7a1279825..dc7e4b344945 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -43,6 +43,8 @@
#include <comphelper/sequence.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/make_unique.hxx>
+
#include <unotools/configpaths.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
@@ -116,12 +118,12 @@ FilterCache::~FilterCache()
}
-FilterCache* FilterCache::clone() const
+std::unique_ptr<FilterCache> FilterCache::clone() const
{
// SAFE -> ----------------------------------
::osl::ResettableMutexGuard aLock(m_aLock);
- FilterCache* pClone = new FilterCache();
+ auto pClone = o3tl::make_unique<FilterCache>();
// Don't copy the configuration access points here.
// They will be created on demand inside the cloned instance,
@@ -143,7 +145,7 @@ FilterCache* FilterCache::clone() const
pClone->m_lChangedFrameLoaders = m_lChangedFrameLoaders;
pClone->m_lChangedContentHandlers = m_lChangedContentHandlers;
- return pClone;
+ return std::move(pClone);
// <- SAFE ----------------------------------
}
diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx
index 4f8b0637ab69..98005e503e4d 100644
--- a/filter/source/config/cache/filtercache.hxx
+++ b/filter/source/config/cache/filtercache.hxx
@@ -20,6 +20,8 @@
#ifndef INCLUDED_FILTER_SOURCE_CONFIG_CACHE_FILTERCACHE_HXX
#define INCLUDED_FILTER_SOURCE_CONFIG_CACHE_FILTERCACHE_HXX
+#include <memory>
+
#include "cacheitem.hxx"
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/util/URL.hpp>
@@ -292,11 +294,8 @@ class FilterCache : public BaseLock
All internal structures will be copied here. But the internal used
configuration (update) access wont be copied. The cloned instance contains
a different one.
-
- @note The cloned instance is created on the heap. The user of this instance
- has to remove it later.
*/
- FilterCache* clone() const;
+ std::unique_ptr<FilterCache> clone() const;
/** @short copy the cache content or rClone back to this instance.