diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-03-22 13:31:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-23 07:41:50 +0100 |
commit | fb6443a17dd676cc50560c7ac91e5e3106138222 (patch) | |
tree | f5d5f0dd7d71d9b2314bdf5b04d9d94e867e801f /comphelper | |
parent | 5947744bd722b17a27243a86fffb45c188f169a5 (diff) |
use single-use attribute for OfficeInstallationDirectories
instead of rtl::Instance, which means it will get
cleaned up when UNO shuts down
Change-Id: If6b0a41d0a8a20ea4989771d83833288c6bd3234
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112926
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/officeinstdir/officeinstallationdirectories.cxx | 22 | ||||
-rw-r--r-- | comphelper/util/comphelp.component | 3 |
2 files changed, 4 insertions, 21 deletions
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index 1bee23622d42..385f61680e1c 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -236,32 +236,14 @@ void OfficeInstallationDirectories::initDirs() } -namespace { - -struct Instance { - explicit Instance( - css::uno::Reference<css::uno::XComponentContext> const & context): - instance(static_cast<cppu::OWeakObject *>( - new comphelper::OfficeInstallationDirectories(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_util_OfficeInstallationDirectories( 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::OfficeInstallationDirectories(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/util/comphelp.component b/comphelper/util/comphelp.component index 10bc0cfe0ccd..1e4e0c8fbf8e 100644 --- a/comphelper/util/comphelp.component +++ b/comphelper/util/comphelp.component @@ -58,7 +58,8 @@ <singleton name="com.sun.star.task.OfficeRestartManager"/> </implementation> <implementation name="com.sun.star.comp.util.OfficeInstallationDirectories" - constructor="com_sun_star_comp_util_OfficeInstallationDirectories"> + constructor="com_sun_star_comp_util_OfficeInstallationDirectories" + single-instance="true"> <service name="com.sun.star.util.OfficeInstallationDirectories"/> <singleton name="com.sun.star.util.theOfficeInstallationDirectories"/> </implementation> |