summaryrefslogtreecommitdiffstats
path: root/stoc/source/javaloader/javaloader.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-05-12 17:41:38 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-05-12 17:50:46 +0200
commit17c4c24294ac302ed78586362ffe0e4142bd120d (patch)
treeae8c3b035617fb73a459e87da8f811c9ca5961e3 /stoc/source/javaloader/javaloader.cxx
parentAdd error handling to RenamePrgFolder and RemovePrgFolder (diff)
downloadcore-17c4c24294ac302ed78586362ffe0e4142bd120d.tar.gz
core-17c4c24294ac302ed78586362ffe0e4142bd120d.zip
Properly use createOneInstanceComponentFactory for javaloader
After 424a7f404565e068995e2a9827d5bc6f76920ec8 "add some more libs to libmerged" had added javaloader to libmerged, destruction of static xStaticRef started to cause problems at least during CppunitTest_services of --enable-mergedlib Windows builds (presumably because the relative order of static variable destruction had changed). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90254 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 9ed75e2c65544b4f71c73e1c51a68d74e31d544b) Change-Id: I8307570222cc9a3d9511d090d0dae7f7dfe7a9ad
Diffstat (limited to 'stoc/source/javaloader/javaloader.cxx')
-rw-r--r--stoc/source/javaloader/javaloader.cxx12
1 files changed, 2 insertions, 10 deletions
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 760f6d356a3c..269cdb182bc7 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -334,14 +334,8 @@ static Mutex & getInitMutex()
/// @throws Exception
static css::uno::Reference<XInterface> JavaComponentLoader_CreateInstance(const css::uno::Reference<XComponentContext> & xCtx)
{
- css::uno::Reference<XInterface> xRet;
-
try {
- MutexGuard guard( getInitMutex() );
- // The javaloader is never destroyed and there can be only one!
- // Note that the first context wins ....
- static css::uno::Reference< XInterface > xStaticRef = *new JavaComponentLoader(xCtx);
- xRet = xStaticRef;
+ return *new JavaComponentLoader(xCtx);
}
catch(const RuntimeException & runtimeException) {
SAL_INFO(
@@ -349,8 +343,6 @@ static css::uno::Reference<XInterface> JavaComponentLoader_CreateInstance(const
"could not init javaloader due to " << runtimeException);
throw;
}
-
- return xRet;
}
} //end namespace
@@ -362,7 +354,7 @@ static const struct ImplementationEntry g_entries[] =
{
{
JavaComponentLoader_CreateInstance, loader_getImplementationName,
- loader_getSupportedServiceNames, createSingleComponentFactory,
+ loader_getSupportedServiceNames, createOneInstanceComponentFactory,
nullptr , 0
},
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }