diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-14 09:09:57 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-15 08:51:25 +0100 |
commit | bdeb57c23973f3ef79020847b2fe39f312cf3c0b (patch) | |
tree | 8e3b8d052b753c228bea7b438d9b18da39ac1b65 /cppuhelper | |
parent | a3f97e65570855858e73e89c050f9c6589d3c7be (diff) |
Initialize constructor based implementations in one place.
Change-Id: I324f25bb5ec7d792c3e015815f2a11b08f519764
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/servicemanager.cxx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 4044c1ce0d56..bebeaa82e641 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -20,6 +20,7 @@ #include "com/sun/star/container/ElementExistException.hpp" #include "com/sun/star/container/XEnumeration.hpp" #include "com/sun/star/container/XNameContainer.hpp" +#include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/lang/XSingleComponentFactory.hpp" #include "com/sun/star/lang/XSingleServiceFactory.hpp" @@ -601,12 +602,18 @@ ImplementationWrapper::createInstanceWithArgumentsAndContext( throw (css::uno::Exception, css::uno::RuntimeException) { loadImplementation(Context); - return constructor_ != 0 - ? css::uno::Reference<css::uno::XInterface>( - (*constructor_)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE) - : factory1_.is() - ? factory1_->createInstanceWithArgumentsAndContext(Arguments, Context) - : factory2_->createInstanceWithArguments(Arguments); + if (constructor_ != 0) { + css::uno::Reference<css::uno::XInterface> xRet( + (*constructor_)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE); + css::uno::Reference<css::lang::XInitialization> xInit( + xRet, css::uno::UNO_QUERY); + if (xInit.is()) + xInit->initialize(Arguments); + return xRet; + } else + return factory1_.is() + ? factory1_->createInstanceWithArgumentsAndContext(Arguments, Context) + : factory2_->createInstanceWithArguments(Arguments); } css::uno::Reference< css::uno::XInterface > @@ -928,9 +935,14 @@ cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext( return css::uno::Reference< css::uno::XInterface >(); } if (impl->constructor != 0) { - return css::uno::Reference<css::uno::XInterface>( + css::uno::Reference<css::uno::XInterface> xRet( (*impl->constructor)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE); + css::uno::Reference<css::lang::XInitialization> xInit( + xRet, css::uno::UNO_QUERY); + if (xInit.is()) + xInit->initialize(Arguments); + return xRet; } else if (impl->factory1.is()) { return impl->factory1->createInstanceWithArgumentsAndContext( Arguments, Context); |