cppuhelper/source/servicemanager.cxx | 1 - sfx2/source/appl/shutdownicon.cxx | 23 ++++++++++++++++++++++- sfx2/util/sfx.component | 1 + 3 files changed, 23 insertions(+), 2 deletions(-)
New commits: commit e5311e010159d79d83b5c1b42bbfbfe9d8df5189 Author: Matúš Kukan <[email protected]> Date: Thu Oct 2 15:15:28 2014 +0200 fdo#80927: css.office.Quickstart should be single-instance service. Incorrectly converted in a384b21cc40818bf3c918951a086a30b5d9d8022 where SFX_IMPL_ONEINSTANCEFACTORY was used. AFAICS it's the first converted single-instance service which implements css::lang::XInitialization. That's kind of strange but can do its job. [email protected]: Three things were necessary in order to not call the ~ShutdownIcon code too late during exit now: * Move the relevant code from ~ShutdownIcon to ShutdownIcon::disposing. * Add a dummy <singleton name="com.sun.star.office.theQuickstart"/> so the service manager will eventually dispose the (single) instance. * In cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments do not shortcut updateDisposeSingleton in that odd case of calling createInstanceWithArguments on an implementation that (effectively) is a singleton (as otherwise the service manager would still not dispose it). It looks to me like that "return inst;" was an inadvertent leftover in 874c481801434d4fac3c50f076bff0fe3a3988b6 "Simplify service manager's tracking of singletons" and wasn't intended to serve some subtle purpose. Change-Id: Icd4d3168ec0bbb820b17ac321fe897ac9f9ce7fc (cherry picked from commit 98bb53a5609f8651b0841e8326d7aa53fd56ab3b) Reviewed-on: https://gerrit.libreoffice.org/11850 Reviewed-by: Andras Timar <[email protected]> Tested-by: Andras Timar <[email protected]> diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 94d2ec5..20471b7 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -734,7 +734,6 @@ cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments( if (init.is()) { init->initialize(arguments); } - return inst; } else if (factory1.is()) { inst = factory1->createInstanceWithArgumentsAndContext( arguments, context); diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 9a5c9e4..11058e2 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -665,6 +665,8 @@ void SAL_CALL ShutdownIcon::disposing() { m_xContext.clear(); m_xDesktop.clear(); + + deInitSystray(); } @@ -968,12 +970,31 @@ void SAL_CALL ShutdownIcon::setFastPropertyValue( ::sal_Int32 return aValue; } +namespace { + +struct Instance { + explicit Instance( + css::uno::Reference<css::uno::XComponentContext> const & context): + instance(static_cast<cppu::OWeakObject *>(new ShutdownIcon(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 * SAL_CALL com_sun_star_comp_desktop_QuickstartWrapper_get_implementation( css::uno::XComponentContext *context, css::uno::Sequence<css::uno::Any> const &) { - return cppu::acquire(new ShutdownIcon(context)); + return cppu::acquire(static_cast<cppu::OWeakObject *>( + Singleton::get(context).instance.get())); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index 203acc8..91002da 100644 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -35,6 +35,7 @@ <implementation name="com.sun.star.comp.desktop.QuickstartWrapper" constructor="com_sun_star_comp_desktop_QuickstartWrapper_get_implementation"> <service name="com.sun.star.office.Quickstart"/> + <singleton name="com.sun.star.office.theQuickstart"/> </implementation> <implementation name="com.sun.star.comp.document.OwnSubFilter" constructor="com_sun_star_comp_document_OwnSubFilter_get_implementation">
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
