diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-16 21:56:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-05-20 15:23:39 +0100 |
commit | f1d6f81ad91366c617e97155b0aa325147090ba2 (patch) | |
tree | 6b346aa0909bc579d5b9dc81cb46c87fc4f4ab47 /unotools | |
parent | 1155685c5368e40f4390558f4456f1095bc2fb25 (diff) |
reimplement this using standard singleton pattern
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/bootstrap.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 8f19fd273578..b3e2a3416ca1 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -41,6 +41,7 @@ #include <osl/diagnose.h> // --------------------------------------------------------------------------------------- #include <rtl/bootstrap.hxx> +#include <rtl/instance.hxx> #include <osl/process.h> // for osl_getExecutableFile #include "tools/getprocessworkingdir.hxx" @@ -145,25 +146,19 @@ namespace utl bool initUserInstallationData(rtl::Bootstrap& _rData); }; - static Bootstrap::Impl* s_pData = NULL; + namespace + { + class theImpl : public rtl::Static<Bootstrap::Impl, theImpl> {}; + } const Bootstrap::Impl& Bootstrap::data() { - if (!s_pData) - { - using namespace osl; - MutexGuard aGuard( Mutex::getGlobalMutex() ); - s_pData = new Impl; - } - return *s_pData; + return theImpl::get(); } void Bootstrap::reloadData() { - if (s_pData != NULL) { - delete s_pData; - s_pData = NULL; - } + theImpl::get().initialize(); } // --------------------------------------------------------------------------------------- |