From 874c481801434d4fac3c50f076bff0fe3a3988b6 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 7 Feb 2014 11:10:06 +0100 Subject: Simplify service manager's tracking of singletons It only tracks whether to dispose a singleton instance now, and (at least conceptually) no longer remembers the single instance (apart from what is necessary in order to call dispose on it), as the underlying implementation already needs to keep track of that to support direct calls of constructor functions. Change-Id: I154bf05438e1db099c1c5ffb1c56377725c6bfc6 --- cppuhelper/source/servicemanager.hxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'cppuhelper/source/servicemanager.hxx') diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx index b6e506bfbd47..1e760ca78310 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -106,8 +106,7 @@ public: new ImplementationInfo( name, loader, uri, environment, constructorName, prefix, alienContext, rdbFile)), - constructor(0), status(STATUS_NEW), - dispose(false) + constructor(0), status(STATUS_NEW), dispose(true) {} Implementation( @@ -120,8 +119,7 @@ public: theComponent): info(new ImplementationInfo(name)), constructor(0), factory1(theFactory1), factory2(theFactory2), - component(theComponent), status(STATUS_LOADED), - dispose(false) + component(theComponent), status(STATUS_LOADED), dispose(true) { assert(theFactory1.is() || theFactory2.is()); } css::uno::Reference createInstance( @@ -146,8 +144,13 @@ public: Status status; osl::Mutex mutex; - css::uno::Reference singleton; + css::uno::Reference< css::lang::XComponent > disposeSingleton; bool dispose; + + private: + void updateDisposeSingleton( + bool singletonRequest, + css::uno::Reference const & instance); }; typedef std::map< rtl::OUString, boost::shared_ptr< Implementation > > -- cgit