framework/source/jobs/jobexecutor.cxx | 25 ++++--------------------- framework/util/fwk.component | 3 ++- 2 files changed, 6 insertions(+), 22 deletions(-)
New commits: commit 1d7cc199faf8b9ccf92926da6a60c99fac063fa5 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Mar 21 18:36:07 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Mar 22 11:58:00 2021 +0100 use single-use attribute for JobExecutor instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: I33e8fa15eda12b326beaede61065a84d236b8154 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112852 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 30b90cca6ec4..5578b877b028 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -383,25 +383,6 @@ void SAL_CALL JobExecutor::disposing( const css::lang::EventObject& aEvent ) /* } SAFE */ } -struct Instance { - explicit Instance( - css::uno::Reference<css::uno::XComponentContext> const & context): - instance( - static_cast<cppu::OWeakObject *>(new JobExecutor(context))) - { - // 2nd phase initialization needed - static_cast<JobExecutor *>(static_cast<cppu::OWeakObject *> - (instance.get()))->initListeners(); - } - - 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 * @@ -409,8 +390,10 @@ com_sun_star_comp_framework_JobExecutor_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<JobExecutor> xJobExec = new JobExecutor(context); + // 2nd phase initialization needed + xJobExec->initListeners(); + return cppu::acquire(xJobExec.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index aad750e76c72..c20c9a30c0e2 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -63,7 +63,8 @@ <service name="com.sun.star.ui.ImageManager"/> </implementation> <implementation name="com.sun.star.comp.framework.JobExecutor" - constructor="com_sun_star_comp_framework_JobExecutor_get_implementation"> + constructor="com_sun_star_comp_framework_JobExecutor_get_implementation" + single-instance="true"> <service name="com.sun.star.task.JobExecutor"/> <singleton name="com.sun.star.task.theJobExecutor"/> </implementation> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits