diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-03-22 13:33:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-23 07:40:23 +0100 |
commit | e657ec8449d306e9c04801e9db3552b96a8a8dd9 (patch) | |
tree | fbf9d516b365293298db50afb0fe912e261df7d8 /comphelper | |
parent | 9a1f9c13439491d3b78a73f6eee5cda4e561401f (diff) |
use single-use attribute for OOfficeRestartManager
instead of rtl::Instance, which means it will get
cleaned up when UNO shuts down
Change-Id: I71d8bd457687537e620a420c3cbf633f7a0b3f97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/officerestartmanager.cxx | 20 | ||||
-rw-r--r-- | comphelper/util/comphelp.component | 3 |
2 files changed, 3 insertions, 20 deletions
diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx index f56486858522..ad6e308d2819 100644 --- a/comphelper/source/misc/officerestartmanager.cxx +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -146,31 +146,13 @@ uno::Sequence< OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNam } // namespace comphelper -namespace { - -struct Instance { - explicit Instance( - css::uno::Reference<css::uno::XComponentContext> const & context): - instance(static_cast<cppu::OWeakObject *>(new comphelper::OOfficeRestartManager(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_task_OfficeRestartManager( 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 comphelper::OOfficeRestartManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/util/comphelp.component b/comphelper/util/comphelp.component index 705e870eb5e0..10bc0cfe0ccd 100644 --- a/comphelper/util/comphelp.component +++ b/comphelper/util/comphelp.component @@ -52,7 +52,8 @@ <service name="com.sun.star.embed.InstanceLocker"/> </implementation> <implementation name="com.sun.star.comp.task.OfficeRestartManager" - constructor="com_sun_star_comp_task_OfficeRestartManager"> + constructor="com_sun_star_comp_task_OfficeRestartManager" + single-instance="true"> <service name="com.sun.star.comp.task.OfficeRestartManager"/> <singleton name="com.sun.star.task.OfficeRestartManager"/> </implementation> |