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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Sat Mar 20 06:53:15 UTC 2021


 framework/source/uifactory/uicontrollerfactory.cxx |   21 +--------------------
 framework/util/fwk.component                       |    3 ++-
 2 files changed, 3 insertions(+), 21 deletions(-)

New commits:
commit ea004488f6d55eaebe58c595ac53392bf936b5e4
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Thu Mar 18 11:23:01 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Mar 20 07:52:33 2021 +0100

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

diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx
index 5f81f80be026..493d1d5522d0 100644
--- a/framework/source/uifactory/uicontrollerfactory.cxx
+++ b/framework/source/uifactory/uicontrollerfactory.cxx
@@ -288,24 +288,6 @@ ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XComponentC
 {
 }
 
-struct ToolbarControllerFactoryInstance {
-    explicit ToolbarControllerFactoryInstance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(static_cast<cppu::OWeakObject *>(
-                    new ToolbarControllerFactory(context)))
-    {
-    }
-
-    css::uno::Reference<css::uno::XInterface> instance;
-};
-
-struct ToolbarControllerFactorySingleton:
-    public rtl::StaticWithArg<
-        ToolbarControllerFactoryInstance,
-        css::uno::Reference<css::uno::XComponentContext>,
-        ToolbarControllerFactorySingleton>
-{};
-
 class StatusbarControllerFactory :  public UIControllerFactory
 {
 public:
@@ -366,8 +348,7 @@ com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation(
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(static_cast<cppu::OWeakObject *>(
-            ToolbarControllerFactorySingleton::get(context).instance.get()));
+    return cppu::acquire(new ToolbarControllerFactory(context));
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 2d71213468d6..80af7267b774 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -145,7 +145,8 @@
     <service name="com.sun.star.frame.TaskCreator"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.ToolBarControllerFactory"
-      constructor="com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation">
+      constructor="com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation"
+      single-instance="true">
     <service name="com.sun.star.frame.ToolbarControllerFactory"/>
     <singleton name="com.sun.star.frame.theToolbarControllerFactory"/>
   </implementation>


More information about the Libreoffice-commits mailing list