diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-03-23 11:11:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-23 19:49:25 +0000 |
commit | e7dbef922a2fc73469f12c520bcc1af54fe038fb (patch) | |
tree | 02c18e1d1c9d0d85914626f66ace24a79f892e79 /desktop/source/deployment/misc/dp_misc.cxx | |
parent | 462ebbd10bd537f42104fe991a0aeebcd563f178 (diff) |
rtl::Static to thread-safe-static
Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source/deployment/misc/dp_misc.cxx')
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index ed394382bb5c..15e31b0fe402 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -62,15 +62,17 @@ using namespace ::com::sun::star::uno; namespace dp_misc { namespace { -struct UnoRc : public rtl::StaticWithInit< - std::shared_ptr<rtl::Bootstrap>, UnoRc> { - std::shared_ptr<rtl::Bootstrap> operator () () { - OUString unorc( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("louno") ); - ::rtl::Bootstrap::expandMacros( unorc ); - auto ret = std::make_shared<::rtl::Bootstrap>( unorc ); - OSL_ASSERT( ret->getHandle() != nullptr ); - return ret; - } +std::shared_ptr<rtl::Bootstrap> & UnoRc() +{ + static std::shared_ptr<rtl::Bootstrap> theRc = []() + { + OUString unorc( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("louno") ); + ::rtl::Bootstrap::expandMacros( unorc ); + auto ret = std::make_shared<::rtl::Bootstrap>( unorc ); + OSL_ASSERT( ret->getHandle() != nullptr ); + return ret; + }(); + return theRc; }; OUString generateOfficePipeId() @@ -293,7 +295,7 @@ OUString makeURLAppendSysPathSegment( std::u16string_view baseURL, OUString cons OUString expandUnoRcTerm( OUString const & term_ ) { OUString term(term_); - UnoRc::get()->expandMacrosFrom( term ); + UnoRc()->expandMacrosFrom( term ); return term; } @@ -318,7 +320,7 @@ OUString expandUnoRcUrl( OUString const & url ) rcurl = ::rtl::Uri::decode( rcurl, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); // expand macro string: - UnoRc::get()->expandMacrosFrom( rcurl ); + UnoRc()->expandMacrosFrom( rcurl ); return rcurl; } else { |