summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-17 18:22:55 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-17 21:33:02 +0100
commit208a63779652789371f782b8e856f762baee2af1 (patch)
tree4fc1dff35845188f5ab35964945a2d4662e05ca9 /comphelper
parentef6083200a4f28e43198c7a0878da6f4b880725f (diff)
Add back XComponentContext to officecfg::...::get() calls
4256c764aee0777770466115a97420d9b55c23ac "do not pass XComponentContext to officecfg::...::get() calls" had removed it, for performance reasons, but 8a695046cfcc8f9ec835b208b0d56ca821a3ff84 "tdf#158375 Hack to make sure process service factory is set" is a case where it should be passed in. To hopefully avoid performance regressions, don't default to comphelper::getProcessComponentContext() for what gets passed in, but default to an empty Reference and only call comphelper::getProcessComponentContext() when actually needed in the implementation. Change-Id: I5b75ac2c28f36e21d1c8bc368b0b972c33c61a51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/configuration.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx
index 00179ea010da..ef89867dd50b 100644
--- a/comphelper/source/misc/configuration.cxx
+++ b/comphelper/source/misc/configuration.cxx
@@ -62,9 +62,10 @@ OUString extendLocalizedPath(std::u16string_view path, OUString const & locale)
}
std::shared_ptr< comphelper::ConfigurationChanges >
-comphelper::ConfigurationChanges::create()
+comphelper::ConfigurationChanges::create(
+ css::uno::Reference<css::uno::XComponentContext> const & context)
{
- return detail::ConfigurationWrapper::get().createChanges();
+ return detail::ConfigurationWrapper::get(context).createChanges();
}
comphelper::ConfigurationChanges::~ConfigurationChanges() {}
@@ -101,9 +102,10 @@ comphelper::ConfigurationChanges::getSet(OUString const & path) const
}
comphelper::detail::ConfigurationWrapper const &
-comphelper::detail::ConfigurationWrapper::get()
+comphelper::detail::ConfigurationWrapper::get(
+ css::uno::Reference<css::uno::XComponentContext> const & context)
{
- static comphelper::detail::ConfigurationWrapper WRAPPER;
+ static comphelper::detail::ConfigurationWrapper WRAPPER(context);
return WRAPPER;
}
@@ -131,8 +133,9 @@ public:
}
};
-comphelper::detail::ConfigurationWrapper::ConfigurationWrapper():
- context_(comphelper::getProcessComponentContext()),
+comphelper::detail::ConfigurationWrapper::ConfigurationWrapper(
+ css::uno::Reference<css::uno::XComponentContext> const & context):
+ context_(context.is() ? context : comphelper::getProcessComponentContext()),
access_(css::configuration::ReadWriteAccess::create(context_, "*")),
mbDisposed(false)
{