accessibility/inc/extended/accessibleeditbrowseboxcell.hxx | 2 +- accessibility/source/extended/accessibleeditbrowseboxcell.cxx | 2 +- canvas/inc/parametricpolypolygon.hxx | 2 +- canvas/source/tools/parametricpolypolygon.cxx | 2 +- comphelper/source/misc/compbase.cxx | 6 ++++-- include/comphelper/compbase.hxx | 7 +++++-- svx/source/accessibility/ChildrenManagerImpl.cxx | 2 +- svx/source/accessibility/ChildrenManagerImpl.hxx | 2 +- svx/source/table/tabledesign.cxx | 2 +- svx/source/xml/xmlgrhlp.cxx | 4 ++-- 10 files changed, 18 insertions(+), 13 deletions(-)
New commits: commit c68c744b68fd50adb6ce725bf9de377a5f915dab Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Dec 24 15:58:17 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Dec 25 13:56:27 2021 +0100 pass unique_lock as param in WeakComponentImplHelperBase::disposing so that subclasses can drop the lock while calling listeners Change-Id: I6105438110af08f10b0ed50057b28172c3442b95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127434 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/accessibility/inc/extended/accessibleeditbrowseboxcell.hxx b/accessibility/inc/extended/accessibleeditbrowseboxcell.hxx index ab45db70af77..ea42155fd0eb 100644 --- a/accessibility/inc/extended/accessibleeditbrowseboxcell.hxx +++ b/accessibility/inc/extended/accessibleeditbrowseboxcell.hxx @@ -120,7 +120,7 @@ namespace accessibility virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; // XComponent/WeakComponentImplHelper - virtual void disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ) = delete; EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ) = delete; diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx index f9985e48a268..a582defcadd6 100644 --- a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx +++ b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx @@ -212,7 +212,7 @@ namespace accessibility return xMyContext; } - void EditBrowseBoxTableCellAccess::disposing() + void EditBrowseBoxTableCellAccess::disposing(std::unique_lock<std::mutex>&) { // dispose our context, if it still alive css::uno::Reference< XComponent > xMyContext( m_aContext.get(), UNO_QUERY ); diff --git a/canvas/inc/parametricpolypolygon.hxx b/canvas/inc/parametricpolypolygon.hxx index 0d39700ff488..303dc5af05fa 100644 --- a/canvas/inc/parametricpolypolygon.hxx +++ b/canvas/inc/parametricpolypolygon.hxx @@ -90,7 +90,7 @@ namespace canvas const css::uno::Sequence< css::uno::Any >& rArgs ); /// Dispose all internal references - virtual void disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; // XParametricPolyPolygon2D virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL getOutline( double t ) override; diff --git a/canvas/source/tools/parametricpolypolygon.cxx b/canvas/source/tools/parametricpolypolygon.cxx index 870f25f2ddbf..96d8fc7f07da 100644 --- a/canvas/source/tools/parametricpolypolygon.cxx +++ b/canvas/source/tools/parametricpolypolygon.cxx @@ -147,7 +147,7 @@ namespace canvas colors, stops, fAspectRatio ); } - void ParametricPolyPolygon::disposing() + void ParametricPolyPolygon::disposing(std::unique_lock<std::mutex>&) { mxDevice.clear(); } diff --git a/comphelper/source/misc/compbase.cxx b/comphelper/source/misc/compbase.cxx index ecae7108ff90..b8a207ceedb1 100644 --- a/comphelper/source/misc/compbase.cxx +++ b/comphelper/source/misc/compbase.cxx @@ -25,12 +25,14 @@ void SAL_CALL WeakComponentImplHelperBase::dispose() if (m_bDisposed) return; m_bDisposed = true; - disposing(); + disposing(aGuard); + if (!aGuard.owns_lock()) + aGuard.lock(); css::lang::EventObject aEvt(static_cast<OWeakObject*>(this)); maEventListeners.disposeAndClear(aGuard, aEvt); } -void WeakComponentImplHelperBase::disposing() {} +void WeakComponentImplHelperBase::disposing(std::unique_lock<std::mutex>&) {} void SAL_CALL WeakComponentImplHelperBase::addEventListener( css::uno::Reference<css::lang::XEventListener> const& rxListener) diff --git a/include/comphelper/compbase.hxx b/include/comphelper/compbase.hxx index 9a8ea3bb6a24..ce3e44b3732e 100644 --- a/include/comphelper/compbase.hxx +++ b/include/comphelper/compbase.hxx @@ -41,8 +41,11 @@ public: virtual void SAL_CALL removeEventListener(css::uno::Reference<css::lang::XEventListener> const& rxListener) override; - /** called by dispose for subclasses to do dispose() work */ - virtual void disposing(); + /** + Called by dispose for subclasses to do dispose() work. + The mutex is held when called, and subclasses can unlock() the guard if necessary. + */ + virtual void disposing(std::unique_lock<std::mutex>&); protected: comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maEventListeners; diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 080d2a204b9d..fa560abed6a0 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -690,7 +690,7 @@ void ChildrenManagerImpl::impl_dispose() } -void ChildrenManagerImpl::disposing() +void ChildrenManagerImpl::disposing(std::unique_lock<std::mutex>&) { impl_dispose(); } diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx index 6cd9a76305b5..f4105c878f47 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.hxx +++ b/svx/source/accessibility/ChildrenManagerImpl.hxx @@ -315,7 +315,7 @@ private: /** This method is called from the component helper base class while disposing. */ - virtual void disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; void impl_dispose(); diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index 1694f8b9338d..baf2ee21ab2c 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -391,7 +391,7 @@ void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& // XComponent -void SAL_CALL TableDesignStyle::disposing() +void TableDesignStyle::disposing() { for(Reference<XStyle> & rCellStyle : maCellStyles) rCellStyle.clear(); diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index a20db0d073d2..f78787d5b674 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -947,7 +947,7 @@ public: protected: // is called from WeakComponentImplHelper when XComponent::dispose() was // called from outside - virtual void disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; // ____ XInitialization ____ // one argument is allowed, which is the XStorage @@ -993,7 +993,7 @@ SvXMLGraphicImportExportHelper::SvXMLGraphicImportExportHelper( SvXMLGraphicHelp m_eGraphicHelperMode( eMode ) {} -void SvXMLGraphicImportExportHelper::disposing() +void SvXMLGraphicImportExportHelper::disposing(std::unique_lock<std::mutex>&) { Reference< XComponent > xComp( m_xGraphicObjectResolver, UNO_QUERY ); OSL_ASSERT( xComp.is());