filter/source/config/cache/basecontainer.cxx | 7 +++---- filter/source/config/cache/basecontainer.hxx | 4 +++- filter/source/config/cache/filtercache.cxx | 12 ++++++------ filter/source/config/cache/filtercache.hxx | 9 ++++----- 4 files changed, 16 insertions(+), 16 deletions(-)
New commits: commit 46410f7e5b79cf42aa52d7a81fe4608c34601ce6 Author: David Tardon <dtar...@redhat.com> Date: Tue May 3 15:09:55 2016 +0200 use unique_ptr Change-Id: I28615a645e6e4763bb03362a90da93a818985a78 diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 0049b43..2c193f3 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 9c0f924..95589b2b 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 3da7a12..dc7e4b3 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 4f8b063..98005e5 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. commit 750935fddb07650967066e00b663f0ab79f820b6 Author: David Tardon <dtar...@redhat.com> Date: Tue May 3 15:04:10 2016 +0200 drop obsolete comment Change-Id: Iad565ccd92b4518ee57f10b65ca4d8ca0730474d diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 6f5616d..3da7a12 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -1850,8 +1850,6 @@ void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XName // special handling for flags! Convert it from an integer flag field back // to a list of names ... - // But note: because we work directly on a reference to the cache item, - // its not allowed to change the value here. We must work on a copy! pIt = aItem.find(PROPNAME_FLAGS); if (pIt != aItem.end()) { commit 390ddd3bde617388e481b6747aa7bbea17d5ddf1 Author: David Tardon <dtar...@redhat.com> Date: Tue May 3 14:49:34 2016 +0200 tdf#99353 take the footgun away from FilterCache FilterCache::impl_saveItem changes the properties of a config. item one-by-one. But it also listens to the configuration changes and reloads the whole item from the configuration on change... Change-Id: I9e4ed1c6b013925d07f0942717fe3421f924279d diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index b9d15cf..6f5616d 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -1786,7 +1786,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( EItemType void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XNameReplace >& xItem, EItemType eType, - const CacheItem& aItem) + const CacheItem aItem) throw(css::uno::Exception) { CacheItem::const_iterator pIt; diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index 93c8d78..4f8b063 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -809,7 +809,7 @@ class FilterCache : public BaseLock /** TODO */ static void impl_saveItem(const css::uno::Reference< css::container::XNameReplace >& xSet , EItemType eType , - const CacheItem& aValue) + const CacheItem aValue) throw(css::uno::Exception); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits