diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-01-17 18:22:55 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-01-17 21:33:02 +0100 |
commit | 208a63779652789371f782b8e856f762baee2af1 (patch) | |
tree | 4fc1dff35845188f5ab35964945a2d4662e05ca9 /pyuno | |
parent | ef6083200a4f28e43198c7a0878da6f4b880725f (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 'pyuno')
-rw-r--r-- | pyuno/source/loader/pyuno_loader.cxx | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index b02ad302fa80..0828e9497f51 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -34,8 +34,6 @@ #include <cppuhelper/factory.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/DeploymentException.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/processfactory.hxx> @@ -247,18 +245,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* pyuno_Loader_get_implementation( css::uno::XComponentContext* ctx , css::uno::Sequence<css::uno::Any> const&) { - //HACK: Reading the configuration via officecfg::... below internally needs the - // comphelper::getProcessServiceFactory(), which might not be set if this code is e.g. executed - // in a uno.bin process when installing a LibreOffice extension written in Python, so make sure - // the process service factory is set: - try { - comphelper::getProcessServiceFactory(); - } catch (css::uno::DeploymentException const &) { - comphelper::setProcessServiceFactory( - css::uno::Reference<css::lang::XMultiServiceFactory>( - ctx->getServiceManager(), css::uno::UNO_QUERY_THROW)); - } - if (officecfg::Office::Common::Security::Scripting::DisablePythonRuntime::get()) + if (officecfg::Office::Common::Security::Scripting::DisablePythonRuntime::get(ctx)) return nullptr; // tdf#114815 init python only once, via single-instace="true" in pythonloader.component |