pyuno/source/loader/pythonloader.component | 2 +- pyuno/source/loader/pyuno_loader.cxx | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-)
New commits: commit d94aa8bd603bec2027f6eed6ac63d8c1cc40e054 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Oct 2 14:21:27 2020 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Oct 2 21:12:20 2020 +0200 Use the new single-instance="true" attribute in pyuno Change-Id: I953dcc31445fc76d219903da56b2cc264f28c220 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103848 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/pyuno/source/loader/pythonloader.component b/pyuno/source/loader/pythonloader.component index 4e22781a6e60..4fc4a255ca2e 100644 --- a/pyuno/source/loader/pythonloader.component +++ b/pyuno/source/loader/pythonloader.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="org.openoffice.comp.pyuno.Loader" - constructor="pyuno_Loader_get_implementation"> + constructor="pyuno_Loader_get_implementation" single-instance="true"> <service name="com.sun.star.loader.Python"/> </implementation> </component> diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index db6acb04dbd8..a92a538161b1 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -172,9 +172,7 @@ static void prependPythonPath( const OUString & pythonPathBootstrap ) namespace { -struct PythonInit -{ -PythonInit() { +void pythonInit() { if ( Py_IsInitialized()) // may be inited by getComponentContext() already return; @@ -228,7 +226,6 @@ PythonInit() { // PyThreadAttach below. PyThreadState_Delete(tstate); } -}; } @@ -236,8 +233,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* pyuno_Loader_get_implementation( css::uno::XComponentContext* ctx , css::uno::Sequence<css::uno::Any> const&) { - // tdf#114815 thread-safe static to init python only once - static PythonInit s_Init; + // tdf#114815 init python only once, via single-instace="true" in pythonloader.component + pythonInit(); Reference< XInterface > ret; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits