[Libreoffice-commits] core.git: stoc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 23 09:26:49 UTC 2021


 stoc/source/corereflection/crefl.cxx            |   20 +-------------------
 stoc/source/corereflection/reflection.component |    3 ++-
 2 files changed, 3 insertions(+), 20 deletions(-)

New commits:
commit 3c534f895c2811d9bcbae06a48fdad7893f0c684
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:50:00 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 10:26:11 2021 +0100

    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 at collabora.co.uk>

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>


More information about the Libreoffice-commits mailing list