summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-03-18 11:14:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-19 13:23:06 +0100
commit42969ac2c3db42460a9aaa8b51df76f58b360526 (patch)
tree8b7e2f7b11208f161bf9938383528e6b8adbd9ac /sfx2
parent426a38ea955742c471c22b4c20f0149ec423f653 (diff)
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@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/notify/globalevents.cxx20
-rw-r--r--sfx2/util/sfx.component3
2 files changed, 4 insertions, 19 deletions
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>