summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-03-21 18:33:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-22 11:57:46 +0100
commitbc22a790b951da3364daa8f7c45dfc9547a8f717 (patch)
treed512998b8fca8e5791019cd0d16a024286fc9e24 /framework
parentb1af864e84166a062d3c41da458a429914eeda89 (diff)
use single-use attribute for AutoRecovery
instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: I53c722e4126f5386b3cd43eee09ccfe4656ebd9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112851 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/autorecovery.cxx26
-rw-r--r--framework/util/fwk.component3
2 files changed, 7 insertions, 22 deletions
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index bdc46b1d73d4..085b627f5794 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -4219,25 +4219,6 @@ void AutoRecovery::st_impl_removeLockFile()
}
}
-struct Instance {
- explicit Instance(
- css::uno::Reference<css::uno::XComponentContext> const & context):
- instance(
- static_cast<cppu::OWeakObject *>(new AutoRecovery(context)))
- {
- // 2nd phase initialization needed
- static_cast<AutoRecovery*>(static_cast<cppu::OWeakObject *>
- (instance.get()))->initListeners();
- }
-
- css::uno::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 *
@@ -4245,8 +4226,11 @@ com_sun_star_comp_framework_AutoRecovery_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()));
+ rtl::Reference<AutoRecovery> xAutoRecovery = new AutoRecovery(context);
+ // 2nd phase initialization needed
+ xAutoRecovery->initListeners();
+
+ return cppu::acquire(xAutoRecovery.get());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index cc5fcfb13faa..aad750e76c72 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -28,7 +28,8 @@
<service name="com.sun.star.ui.ToolBarFactory"/>
</implementation>
<implementation name="com.sun.star.comp.framework.AutoRecovery"
- constructor="com_sun_star_comp_framework_AutoRecovery_get_implementation">
+ constructor="com_sun_star_comp_framework_AutoRecovery_get_implementation"
+ single-instance="true">
<service name="com.sun.star.frame.AutoRecovery"/>
<singleton name="com.sun.star.frame.theAutoRecovery"/>
</implementation>