[Libreoffice-commits] core.git: stoc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 23 06:40:26 UTC 2021
stoc/source/javavm/javavm.component | 3 ++-
stoc/source/javavm/javavm.cxx | 20 ++------------------
2 files changed, 4 insertions(+), 19 deletions(-)
New commits:
commit 951a9342631129832e647bd8a303a959308bad65
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:45:32 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 07:39:40 2021 +0100
use single-use attribute for JavaVirtualMachine
instead of rtl::Instance, which means it will get
cleaned up when UNO shuts down
Change-Id: Iecf943584d71aac0ed147ff4b6fce49192ef2787
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112929
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/stoc/source/javavm/javavm.component b/stoc/source/javavm/javavm.component
index 79d993ddd62c..71379052b89e 100644
--- a/stoc/source/javavm/javavm.component
+++ b/stoc/source/javavm/javavm.component
@@ -20,7 +20,8 @@
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.stoc.JavaVirtualMachine"
- constructor="stoc_JavaVM_get_implementation">
+ constructor="stoc_JavaVM_get_implementation"
+ single-instance="true">
<service name="com.sun.star.java.JavaVirtualMachine"/>
<singleton name="com.sun.star.java.theJavaVirtualMachine"/>
</implementation>
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 19bce9f5f2cd..35fc0cb9c7d9 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -1471,29 +1471,13 @@ void JavaVirtualMachine::handleJniException(JNIEnv * environment) {
}
-static osl::Mutex m_aMutex;
-static rtl::Reference< JavaVirtualMachine > m_xSingleton;
-
-
-void JavaVirtualMachine::dispose() {
- JavaVirtualMachine_Impl::dispose();
- osl::MutexGuard aGuard(m_aMutex);
- m_xSingleton.clear();
-}
+void JavaVirtualMachine::dispose() {}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
stoc_JavaVM_get_implementation(
css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
- // Only one single instance of this service is ever constructed, and is
- // available until the component context used to create this instance is
- // disposed. Afterwards, this function throws a DisposedException (as do
- // all relevant methods on the single service instance).
- osl::MutexGuard aGuard(m_aMutex);
- if (!m_xSingleton.is())
- m_xSingleton.set(new JavaVirtualMachine(context));
- m_xSingleton->acquire();
- return static_cast<cppu::OWeakObject*>(m_xSingleton.get());
+ return static_cast<cppu::OWeakObject*>(new JavaVirtualMachine(context));
}
More information about the Libreoffice-commits
mailing list