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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 19 12:23:49 UTC 2021


 sfx2/source/notify/globalevents.cxx |   20 ++------------------
 sfx2/util/sfx.component             |    3 ++-
 2 files changed, 4 insertions(+), 19 deletions(-)

New commits:
commit 42969ac2c3db42460a9aaa8b51df76f58b360526
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Thu Mar 18 11:14:46 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Mar 19 13:23:06 2021 +0100

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

diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx
index 9ac9e8707565..2176c327243f 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ b/sfx2/source/notify/globalevents.cxx
@@ -519,30 +519,14 @@ TModelList::iterator SfxGlobalEvents_Impl::impl_searchDoc(const uno::Reference<
         });
 }
 
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(
-            static_cast<cppu::OWeakObject *>(new SfxGlobalEvents_Impl(context)))
-    {}
-
-    rtl::Reference<css::uno::XInterface> instance;
-};
-
-struct Singleton:
-    public rtl::StaticWithArg<
-        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
-}
+} // namespace
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
 com_sun_star_comp_sfx2_GlobalEventBroadcaster_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 SfxGlobalEvents_Impl(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index 314b8c18ecc9..a8f4b7104991 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -70,7 +70,8 @@
     <service name="com.sun.star.frame.DocumentTemplates"/>
   </implementation>
   <implementation name="com.sun.star.comp.sfx2.GlobalEventBroadcaster"
-      constructor="com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation">
+      constructor="com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation"
+      single-instance="true">
     <service name="com.sun.star.frame.GlobalEventBroadcaster"/>
     <singleton name="com.sun.star.frame.theGlobalEventBroadcaster"/>
   </implementation>


More information about the Libreoffice-commits mailing list