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

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


 extensions/source/logging/log.component |    3 ++-
 extensions/source/logging/logger.cxx    |   21 +--------------------
 2 files changed, 3 insertions(+), 21 deletions(-)

New commits:
commit 5947744bd722b17a27243a86fffb45c188f169a5
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:27:55 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 07:41:25 2021 +0100

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

diff --git a/extensions/source/logging/log.component b/extensions/source/logging/log.component
index d4bda58c6900..ae221bb5768d 100644
--- a/extensions/source/logging/log.component
+++ b/extensions/source/logging/log.component
@@ -32,7 +32,8 @@
     <service name="com.sun.star.logging.FileHandler"/>
   </implementation>
   <implementation name="com.sun.star.comp.extensions.LoggerPool"
-      constructor="com_sun_star_comp_extensions_LoggerPool">
+      constructor="com_sun_star_comp_extensions_LoggerPool"
+      single-instance="true">
     <singleton name="com.sun.star.logging.LoggerPool"/>
   </implementation>
   <implementation name="com.sun.star.comp.extensions.PlainTextFormatter"
diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx
index 1770ca377175..a49f8de87c93 100644
--- a/extensions/source/logging/logger.cxx
+++ b/extensions/source/logging/logger.cxx
@@ -255,31 +255,12 @@ namespace logging
 
 } // namespace logging
 
-namespace {
-
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(static_cast<cppu::OWeakObject *>(new logging::LoggerPool(context)))
-    {}
-
-    rtl::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 *
 com_sun_star_comp_extensions_LoggerPool(
     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 logging::LoggerPool(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list