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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 23 06:40:47 UTC 2021


 stoc/source/inspect/introspection.component |    3 ++-
 stoc/source/inspect/introspection.cxx       |   16 +---------------
 2 files changed, 3 insertions(+), 16 deletions(-)

New commits:
commit 9a1f9c13439491d3b78a73f6eee5cda4e561401f
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:47:27 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 07:39:57 2021 +0100

    use single-use attribute for Introspection
    
    instead of rtl::Instance, which means it will get
    cleaned up when UNO shuts down
    
    Change-Id: I8b9ed057ca77b9c783ad353b88205b296dbe54ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112930
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component
index 4cf06357ae24..84e121fad1f7 100644
--- a/stoc/source/inspect/introspection.component
+++ b/stoc/source/inspect/introspection.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.Introspection"
-      constructor="com_sun_star_comp_stoc_Introspection_get_implementation">
+      constructor="com_sun_star_comp_stoc_Introspection_get_implementation"
+      single-instance="true">
     <service name="com.sun.star.beans.Introspection"/>
     <singleton name="com.sun.star.beans.theIntrospection"/>
   </implementation>
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 9317a5c35493..c7c0fd638175 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -2404,20 +2404,6 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
     return new ImplIntrospectionAccess(aToInspectObj, pAccess);
 }
 
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(new Implementation(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 *
@@ -2427,7 +2413,7 @@ com_sun_star_comp_stoc_Introspection_get_implementation(
 {
     SAL_WARN_IF(
         arguments.hasElements(), "stoc", "unexpected singleton arguments");
-    return cppu::acquire(Singleton::get(context).instance.get());
+    return cppu::acquire(new Implementation(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list