summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-03-22 13:50:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-23 10:26:11 +0100
commit3c534f895c2811d9bcbae06a48fdad7893f0c684 (patch)
tree02cff96d884aae50a4fce139493bb665f53b372c /stoc
parent93f23786c6b4a4fffb799b11ccdc736c0cc64995 (diff)
use single-use attribute for IdlReflectionServiceImpl
instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: Icf87023bba5932c3b6e229b71c421fce17e86db9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112931 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/corereflection/crefl.cxx20
-rw-r--r--stoc/source/corereflection/reflection.component3
2 files changed, 3 insertions, 20 deletions
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index e4f879495c3f..e19869e5d9df 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -367,24 +367,6 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno(
}
-namespace {
-
-struct Instance {
- explicit Instance(
- css::uno::Reference<css::uno::XComponentContext> const & context):
- instance(new stoc_corefl::IdlReflectionServiceImpl(context))
- {}
-
- rtl::Reference<cppu::OWeakObject> instance;
-};
-
-struct Singleton:
- public rtl::StaticWithArg<
- Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
com_sun_star_comp_stoc_CoreReflection_get_implementation(
css::uno::XComponentContext * context,
@@ -392,7 +374,7 @@ com_sun_star_comp_stoc_CoreReflection_get_implementation(
{
SAL_WARN_IF(
arguments.hasElements(), "stoc", "unexpected singleton arguments");
- return cppu::acquire(Singleton::get(context).instance.get());
+ return cppu::acquire(new stoc_corefl::IdlReflectionServiceImpl(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/corereflection/reflection.component b/stoc/source/corereflection/reflection.component
index 6ebd541950bf..70ccb68e0402 100644
--- a/stoc/source/corereflection/reflection.component
+++ b/stoc/source/corereflection/reflection.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.CoreReflection"
- constructor="com_sun_star_comp_stoc_CoreReflection_get_implementation">
+ constructor="com_sun_star_comp_stoc_CoreReflection_get_implementation"
+ single-instance="true">
<service name="com.sun.star.reflection.CoreReflection"/>
<singleton name="com.sun.star.reflection.theCoreReflection"/>
</implementation>