summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-25 23:22:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-02-27 09:45:57 +0000
commite87810b69331f5d62cbeac0182c5bc2143f8856f (patch)
tree8f662664fb18ede87dfca78fb9d2e2cfdb086a4b
parent7c0b65c75fc468f9bb32d3a963ee4474bf176f50 (diff)
use a non-leaky singleton
-rw-r--r--sw/source/core/docnode/retrievedinputstreamdata.cxx17
-rw-r--r--sw/source/core/inc/retrievedinputstreamdata.hxx5
-rwxr-xr-xunusedcode.easy3
3 files changed, 11 insertions, 14 deletions
diff --git a/sw/source/core/docnode/retrievedinputstreamdata.cxx b/sw/source/core/docnode/retrievedinputstreamdata.cxx
index ab0e6699ac3f..5436ed9cde5f 100644
--- a/sw/source/core/docnode/retrievedinputstreamdata.cxx
+++ b/sw/source/core/docnode/retrievedinputstreamdata.cxx
@@ -33,20 +33,19 @@
#i73788#
*/
-SwRetrievedInputStreamDataManager* SwRetrievedInputStreamDataManager::mpManager = 0;
SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::mnNextKeyValue = 1;
-osl::Mutex SwRetrievedInputStreamDataManager::maGetManagerMutex;
-SwRetrievedInputStreamDataManager& SwRetrievedInputStreamDataManager::GetManager()
+namespace
{
- osl::MutexGuard aGuard(maGetManagerMutex);
-
- if ( mpManager == 0 )
+ class theSwRetrievedInputStreamDataManager :
+ public rtl::Static< SwRetrievedInputStreamDataManager, theSwRetrievedInputStreamDataManager>
{
- mpManager = new SwRetrievedInputStreamDataManager();
- }
+ };
+}
- return *mpManager;
+SwRetrievedInputStreamDataManager& SwRetrievedInputStreamDataManager::GetManager()
+{
+ return theSwRetrievedInputStreamDataManager::get();
}
SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::ReserveData(
diff --git a/sw/source/core/inc/retrievedinputstreamdata.hxx b/sw/source/core/inc/retrievedinputstreamdata.hxx
index 652e14633061..a7bef2f7efe0 100644
--- a/sw/source/core/inc/retrievedinputstreamdata.hxx
+++ b/sw/source/core/inc/retrievedinputstreamdata.hxx
@@ -31,6 +31,7 @@
#include <tools/link.hxx>
#include <sal/types.h>
#include <osl/mutex.hxx>
+#include <rtl/instance.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/io/XInputStream.hpp>
@@ -93,14 +94,14 @@ class SwRetrievedInputStreamDataManager
private:
- static SwRetrievedInputStreamDataManager* mpManager;
static tDataKey mnNextKeyValue;
- static osl::Mutex maGetManagerMutex;
osl::Mutex maMutex;
std::map< tDataKey, tData > maInputStreamData;
+ template<typename T, typename Unique> friend class rtl::Static;
+
SwRetrievedInputStreamDataManager()
{
};
diff --git a/unusedcode.easy b/unusedcode.easy
index 6d42adf99cf5..3881c2e1b9ab 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1162,9 +1162,6 @@ sdr::table::SdrTableObj::getColumnCount() const
sdr::table::SdrTableObj::getRowCount() const
sfx2::TaskPaneWrapper::GetChildWindowId()
slideshow::internal::DrawShapeSubsetting::reset(slideshow::internal::DocTreeNode const&, boost::shared_ptr<GDIMetaFile> const&)
-std::__cxx1998::map<rtl::OUString, OutputStorageWrapper_Impl*, OUStringLess, std::allocator<std::pair<rtl::OUString const, OutputStorageWrapper_Impl*> > >::~map()
-std::__cxx1998::map<rtl::OUString, binfilter::OutputStorageWrapper_Impl*, binfilter::OUStringLess, std::allocator<std::pair<rtl::OUString const, binfilter::OutputStorageWrapper_Impl*> > >::~map()
-std::__cxx1998::map<unsigned long, SwRetrievedInputStreamDataManager::tData, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, SwRetrievedInputStreamDataManager::tData> > >::~map()
std::__cxx1998::multimap<_xmlNode*, com::sun::star::uno::Reference<com::sun::star::xml::dom::events::XEventListener>, std::less<_xmlNode*>, std::allocator<std::pair<_xmlNode* const, com::sun::star::uno::Reference<com::sun::star::xml::dom::events::XEventListener> > > >::~multimap()
std::__cxx1998::vector<CntHTTPCookie*, std::allocator<CntHTTPCookie*> >::~vector()
std::__cxx1998::vector<OrderedEntry*, std::allocator<OrderedEntry*> >::~vector()