cppuhelper/source/factory.cxx | 61 ++++++++---------------------------------- 1 file changed, 12 insertions(+), 49 deletions(-)
New commits: commit 55b534660e3fc99a4e4e07cf05df7798e9ba0726 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Jan 13 08:37:12 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Jan 13 09:37:49 2023 +0000 OFactoryComponentHelper's XAggregation is apparently unused It had been using cppu::OComponentHelper (which derives from XAggregation) ever since b525a3115f54576017a576ff842dede5e2e3545d "initial import", bug e.g. ORegistryFactoryHelper deriving from it implements queryInterface in a way that is incompatible with XAggregation (it should only have forwarded to OFactoryComponentHelper::queryInterface, and rather implemented its logic in an ORegistryFactoryHelper::queryAggregation override). Also, without this commit but instead with a local > diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx > index c8efcab0e604..9011264b3f3a 100644 > --- a/cppuhelper/source/factory.cxx > +++ b/cppuhelper/source/factory.cxx > @@ -241,6 +241,7 @@ class OFactoryComponentHelper > , public OComponentHelper > , public OSingleFactoryHelper > { > + void SAL_CALL setDelegator(css::uno::Reference<css::uno::XInterface> const &) final { assert(false); } > public: > OFactoryComponentHelper( > const Reference<XMultiServiceFactory > & rServiceManager, `make check` still succeeded for me on Linux, without hitting that injected assert that should have fired if that XAggregation mechanism had been used after all. So switch from OComponentHelper to WeakComponentImplHelper here (which is the simplest implementation helper to use, even if it still needs the non-standard OFactoryComponentHelper::getTypes overriding the non-fitting WeakComponentImplHelper default implementation). Change-Id: I9fc2f4f2ef36bd016f9a943a8efd5e4ac5f3baaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145428 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index 6d5cdc7b23bc..85d32383a0ce 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -21,7 +21,7 @@ #include <osl/diagnose.h> #include <osl/mutex.hxx> #include <cppuhelper/weak.hxx> -#include <cppuhelper/component.hxx> +#include <cppuhelper/compbase.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/queryinterface.hxx> @@ -65,11 +65,11 @@ struct OFactoryComponentHelper_Mutex class OFactoryComponentHelper : public OFactoryComponentHelper_Mutex - , public OComponentHelper - , public XServiceInfo - , public XSingleServiceFactory - , public lang::XSingleComponentFactory - , public XUnloadingPreference + , public WeakComponentImplHelper< + XServiceInfo, + XSingleServiceFactory, + lang::XSingleComponentFactory, + XUnloadingPreference> { public: OFactoryComponentHelper( @@ -79,7 +79,7 @@ public: ComponentFactoryFunc fptr, const Sequence< OUString > * pServiceNames_, bool bOneInstance_ ) - : OComponentHelper( aMutex ) + : WeakComponentImplHelper( aMutex ) , bOneInstance( bOneInstance_ ) , xSMgr( rServiceManager ) , pCreateFunction( pCreateFunction_ ) @@ -90,13 +90,6 @@ public: aServiceNames = *pServiceNames_; } - // XInterface - Any SAL_CALL queryInterface( const Type & rType ) override; - void SAL_CALL acquire() noexcept override - { OComponentHelper::acquire(); } - void SAL_CALL release() noexcept override - { OComponentHelper::release(); } - // XSingleServiceFactory Reference<XInterface > SAL_CALL createInstance() override; Reference<XInterface > SAL_CALL createInstanceWithArguments( const Sequence<Any>& Arguments ) override; @@ -114,16 +107,12 @@ public: // XTypeProvider virtual Sequence< Type > SAL_CALL getTypes() override; - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - - // XAggregation - Any SAL_CALL queryAggregation( const Type & rType ) override; // XUnloadingPreference virtual sal_Bool SAL_CALL releaseOnNotification() override; - // OComponentHelper - void SAL_CALL dispose() override; + // WeakComponentImplHelper + void SAL_CALL disposing() override; private: css::uno::Reference<css::uno::XInterface> createInstanceWithArgumentsEveryTime( @@ -156,25 +145,6 @@ protected: } -Any SAL_CALL OFactoryComponentHelper::queryInterface( const Type & rType ) -{ - return OComponentHelper::queryInterface( rType ); -} - -// XAggregation -Any OFactoryComponentHelper::queryAggregation( const Type & rType ) -{ - Any aRet( OComponentHelper::queryAggregation( rType ) ); - return (aRet.hasValue() - ? aRet - : ::cppu::queryInterface( - rType, - static_cast< XSingleComponentFactory * >( this ), - static_cast< XSingleServiceFactory * >( this ), - static_cast< XServiceInfo * >( this ) , - static_cast< XUnloadingPreference * >( this ))); -} - // XTypeProvider Sequence< Type > OFactoryComponentHelper::getTypes() { @@ -189,11 +159,6 @@ Sequence< Type > OFactoryComponentHelper::getTypes() return Sequence< Type >( ar, m_fptr ? 4 : 3 ); } -Sequence< sal_Int8 > OFactoryComponentHelper::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // OFactoryComponentHelper Reference<XInterface > OFactoryComponentHelper::createInstanceEveryTime( Reference< XComponentContext > const & xContext ) @@ -320,11 +285,9 @@ OFactoryComponentHelper::createInstanceWithArgumentsEveryTime( } -// OComponentHelper -void OFactoryComponentHelper::dispose() +// WeakComponentImplHelper +void OFactoryComponentHelper::disposing() { - OComponentHelper::dispose(); - Reference<XInterface > x; { // do not delete in the guard section @@ -385,7 +348,7 @@ public: bool bOneInstance_ ) : OFactoryComponentHelper( rServiceManager, rImplementationName_, nullptr, nullptr, nullptr, bOneInstance_ ), - OPropertySetHelper( OComponentHelper::rBHelper ), + OPropertySetHelper( WeakComponentImplHelper::rBHelper ), xImplementationKey( xImplementationKey_ ) {}