summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-03-11 08:04:03 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-03-11 09:49:03 +0100
commit4015b22dbc10bc246a3ef704d8b75e8f8cdca519 (patch)
tree600f8b82274f6f6af7d2b40df4bddebd20a728bc /comphelper
parent7002caa97e10d29353d3490b4fbb782d436575b3 (diff)
Simplify ConfigurationWrapper singleton construction a bit
Change-Id: I8b0dd0e049ebeb3304673df3bdb9fe7c755b7750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/configuration.cxx20
1 files changed, 7 insertions, 13 deletions
diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx
index 11c3f97ad1cd..a8ef15ac9178 100644
--- a/comphelper/source/misc/configuration.cxx
+++ b/comphelper/source/misc/configuration.cxx
@@ -41,12 +41,6 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace {
-comphelper::detail::ConfigurationWrapper& GetTheConfigurationWrapper()
-{
- static comphelper::detail::ConfigurationWrapper WRAPPER(comphelper::getProcessComponentContext());
- return WRAPPER;
-}
-
OUString getDefaultLocale(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
@@ -72,7 +66,7 @@ OUString extendLocalizedPath(std::u16string_view path, OUString const & locale)
std::shared_ptr< comphelper::ConfigurationChanges >
comphelper::ConfigurationChanges::create()
{
- return GetTheConfigurationWrapper().createChanges();
+ return detail::ConfigurationWrapper::get().createChanges();
}
comphelper::ConfigurationChanges::~ConfigurationChanges() {}
@@ -111,7 +105,8 @@ comphelper::ConfigurationChanges::getSet(OUString const & path) const
comphelper::detail::ConfigurationWrapper const &
comphelper::detail::ConfigurationWrapper::get()
{
- return GetTheConfigurationWrapper();
+ static comphelper::detail::ConfigurationWrapper WRAPPER;
+ return WRAPPER;
}
namespace
@@ -138,16 +133,15 @@ public:
} // namespace
-comphelper::detail::ConfigurationWrapper::ConfigurationWrapper(
- css::uno::Reference< css::uno::XComponentContext > const & context):
- context_(context),
- access_(css::configuration::ReadWriteAccess::create(context, "*"))
+comphelper::detail::ConfigurationWrapper::ConfigurationWrapper():
+ context_(comphelper::getProcessComponentContext()),
+ access_(css::configuration::ReadWriteAccess::create(context_, "*"))
{
// Set up a configuration notifier to invalidate the cache as needed.
try
{
css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
- css::configuration::theDefaultProvider::get( context ) );
+ css::configuration::theDefaultProvider::get( context_ ) );
// set root path
css::uno::Sequence< css::uno::Any > params {