summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-01-19 14:47:03 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-01-19 16:07:12 +0000
commit41f659b49250dd62abc141afaa3c73cc63a425e3 (patch)
tree6904d55087ab863a427a02d9db12a4f4e4ce7266 /basic
parent52b465e271961a65f356c9a5b354acead3c0a849 (diff)
Base SfxLibrary on WeakComponentImplHelper
...rather than on the deprecated OComponentHelper. The two classes SfxDialogLibrary and SfxScriptLibrary, both deriving from SfxLibrary, had been found to implement their respective queryInterface in a way that is incompatible with the XAggregation protocol inherited via OComponentHelper. It looks like no code actually made use of the XAggregation offered by these Sfx*Library classes, so the easiest fix for those queryInterface implementations appears to switch from OComponentHelper to WeakComponentImplHelper (thereby dropping XAggregation, and thus rendering the existing queryInterface implementations OK). Ideally, SfxLibrary would derive from WeakComponentImplHelper<XInitialization, XStorageBasedLibraryContainer, XLibraryContainerPassword, ...> covering all the UNO interface classes from which it currently derives manually. But changing that manual implementation across SfxLibrary and its SfxDialogLibrary and SfxScriptLibrary derived classes looks tricky, so merely introduce an "empty" WeakComponentImplHelper<> for now and keep all the manual stuff, and leave proper clean up for later. Change-Id: I12dc5bad2c017b8d76ce28ac189e95cf2e3810e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145792 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/inc/namecont.hxx7
-rw-r--r--basic/source/uno/namecont.cxx8
2 files changed, 7 insertions, 8 deletions
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 5875b6369faf..b5a261c2dde1 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -47,7 +47,6 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/component.hxx>
#include <cppuhelper/basemutex.hxx>
#include <rtl/ref.hxx>
#include <comphelper/interfacecontainer3.hxx>
@@ -470,7 +469,7 @@ class SfxLibrary
, public css::container::XContainer
, public css::util::XChangesNotifier
, public ::cppu::BaseMutex
- , public ::cppu::OComponentHelper
+ , public ::cppu::WeakComponentImplHelper<>
{
friend class SfxLibraryContainer;
friend class SfxDialogLibraryContainer;
@@ -550,8 +549,8 @@ public:
// Methods XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override;
- virtual void SAL_CALL acquire() noexcept override { OComponentHelper::acquire(); }
- virtual void SAL_CALL release() noexcept override { OComponentHelper::release(); }
+ virtual void SAL_CALL acquire() noexcept override { WeakComponentImplHelper::acquire(); }
+ virtual void SAL_CALL release() noexcept override { WeakComponentImplHelper::release(); }
// Methods XElementAccess
virtual css::uno::Type SAL_CALL getElementType( ) override;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 431f55b2a4d2..24bcddbded53 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2930,7 +2930,7 @@ sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const OUString& _rServic
// Ctor
SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
const Reference< XSimpleFileAccess3 >& xSFI )
- : OComponentHelper( m_aMutex )
+ : WeakComponentImplHelper( m_aMutex )
, mxSFI( xSFI )
, mrModifiable( _rModifiable )
, maNameContainer( new NameContainer(aType) )
@@ -2952,7 +2952,7 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
const Reference< XSimpleFileAccess3 >& xSFI,
OUString aLibInfoFileURL, OUString aStorageURL, bool ReadOnly )
- : OComponentHelper( m_aMutex )
+ : WeakComponentImplHelper( m_aMutex )
, mxSFI( xSFI )
, mrModifiable( _rModifiable )
, maNameContainer( new NameContainer(aType) )
@@ -3004,7 +3004,7 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType )
static_cast< XChangesNotifier * >( this ) );
if( !aRet.hasValue() )
{
- aRet = OComponentHelper::queryInterface( rType );
+ aRet = WeakComponentImplHelper::queryInterface( rType );
}
return aRet;
}
@@ -3140,7 +3140,7 @@ Sequence< Type > SfxLibrary::getTypes()
cppu::UnoType<XNameContainer>::get(),
cppu::UnoType<XContainer>::get(),
cppu::UnoType<XChangesNotifier>::get(),
- OComponentHelper::getTypes() );
+ WeakComponentImplHelper::getTypes() );
return ourTypes_NameContainer.getTypes();
}