summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-03-22 13:27:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-23 07:41:25 +0100
commit5947744bd722b17a27243a86fffb45c188f169a5 (patch)
tree8a8212b16d0952b77c27492b56c3afbb702cb98e /extensions
parente657ec8449d306e9c04801e9db3552b96a8a8dd9 (diff)
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@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/logging/log.component3
-rw-r--r--extensions/source/logging/logger.cxx21
2 files changed, 3 insertions, 21 deletions
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: */