diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-17 14:00:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-18 08:00:23 +0100 |
commit | 10f4db67b6690cecfe449b4283b52f56400f07e2 (patch) | |
tree | f9fe0456102407e9866655e1e6818e076edaea45 /extensions/source | |
parent | 51e7a590976f664deb0a386d23b66bee38ea5687 (diff) |
Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)
Change-Id: Ib0965f57cb929a220fc9df381abdca654985c9de
Reviewed-on: https://gerrit.libreoffice.org/85330
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/propctrlr/modulepcr.cxx | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx index a7da05f3e947..88b6d4d97152 100644 --- a/extensions/source/propctrlr/modulepcr.cxx +++ b/extensions/source/propctrlr/modulepcr.cxx @@ -19,38 +19,27 @@ #include "modulepcr.hxx" -#include <rtl/instance.hxx> -#include <osl/getglobalmutex.hxx> #include <unotools/resmgr.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> namespace pcr { - struct CreateModuleClass - { - PcrModule* operator()() - { - static PcrModule* pModule = new PcrModule; - return pModule; - /* yes, in theory, this is a resource leak, since the PcrModule - will never be cleaned up. However, using a non-heap instance of PcrModule - would not work: It would be cleaned up when the module is unloaded. - This might happen (and is likely to happen) *after* the tools-library - has been unloaded. However, the module's dtor is where we would delete - our resource manager (in case not all our clients de-registered) - which - would call into the already-unloaded tools-library. */ - } - }; - PcrModule::PcrModule() { } PcrModule& PcrModule::getInstance() { - return *rtl_Instance< PcrModule, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >:: - create( CreateModuleClass(), ::osl::GetGlobalMutex() ); + static PcrModule* pModule = new PcrModule; + return *pModule; + /* yes, in theory, this is a resource leak, since the PcrModule + will never be cleaned up. However, using a non-heap instance of PcrModule + would not work: It would be cleaned up when the module is unloaded. + This might happen (and is likely to happen) *after* the tools-library + has been unloaded. However, the module's dtor is where we would delete + our resource manager (in case not all our clients de-registered) - which + would call into the already-unloaded tools-library. */ } OUString PcrRes(const char* pId) |