[Libreoffice-commits] core.git: 2 commits - framework/source framework/util

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 19 19:04:58 UTC 2021


 framework/source/uiconfiguration/moduleuicfgsupplier.cxx      |   19 ----------
 framework/source/uiconfiguration/windowstateconfiguration.cxx |   19 ----------
 framework/util/fwk.component                                  |    6 ++-
 3 files changed, 6 insertions(+), 38 deletions(-)

New commits:
commit ccef00e160439f1836ab27cd13cbe6aa8f9e5146
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Thu Mar 18 11:27:23 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Mar 19 20:04:25 2021 +0100

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

diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index ba8d0c15a43e..31b08076e953 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -1383,22 +1383,6 @@ sal_Bool SAL_CALL WindowStateConfiguration::hasElements()
     return true;
 }
 
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(static_cast<cppu::OWeakObject *>(
-                    new WindowStateConfiguration(context)))
-    {
-    }
-
-    css::uno::Reference<css::uno::XInterface> instance;
-};
-
-struct Singleton:
-    public rtl::StaticWithArg<
-        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
@@ -1406,8 +1390,7 @@ com_sun_star_comp_framework_WindowStateConfiguration_get_implementation(
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(static_cast<cppu::OWeakObject *>(
-                Singleton::get(context).instance.get()));
+    return cppu::acquire(new WindowStateConfiguration(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index efc79a108e5d..f3a0cfcf1edd 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -183,7 +183,8 @@
     <singleton name="com.sun.star.ui.theWindowContentFactoryManager"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.WindowStateConfiguration"
-      constructor="com_sun_star_comp_framework_WindowStateConfiguration_get_implementation">
+      constructor="com_sun_star_comp_framework_WindowStateConfiguration_get_implementation"
+      single-instance="true">
     <service name="com.sun.star.ui.WindowStateConfiguration"/>
     <singleton name="com.sun.star.ui.theWindowStateConfiguration"/>
   </implementation>
commit 2167edad3b1f79e304a072b4d74eb1705cfe66b4
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Thu Mar 18 11:31:28 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Mar 19 20:04:18 2021 +0100

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

diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
index 31d61d8d0ad5..f28c2afedddf 100644
--- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
+++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
@@ -171,22 +171,6 @@ Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSuppli
     return pIter->second;
 }
 
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(static_cast<cppu::OWeakObject *>(
-                    new ModuleUIConfigurationManagerSupplier(context)))
-    {
-    }
-
-    css::uno::Reference<css::uno::XInterface> instance;
-};
-
-struct Singleton:
-    public rtl::StaticWithArg<
-        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
@@ -194,8 +178,7 @@ com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementat
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(static_cast<cppu::OWeakObject *>(
-                Singleton::get(context).instance.get()));
+    return cppu::acquire(new ModuleUIConfigurationManagerSupplier(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 9f050373c603..efc79a108e5d 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -91,7 +91,8 @@
     <service name="com.sun.star.ui.ModuleUIConfigurationManager"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.ModuleUIConfigurationManagerSupplier"
-      constructor="com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation">
+      constructor="com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation"
+      single-instance="true">
     <service name="com.sun.star.ui.ModuleUIConfigurationManagerSupplier"/>
     <singleton name="com.sun.star.ui.theModuleUIConfigurationManagerSupplier"/>
   </implementation>


More information about the Libreoffice-commits mailing list