comphelper/source/misc/SelectionMultiplex.cxx | 9 +++++++++ include/comphelper/SelectionMultiplex.hxx | 2 ++ reportdesign/source/ui/dlg/Navigator.cxx | 1 + 3 files changed, 12 insertions(+)
New commits: commit a152b1fe7fc3056ff6444321a1cdf8c24b8c8a2f Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Wed Aug 24 16:42:54 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Sep 13 13:39:33 2022 +0200 tdf#150575: REPORTBUILDER: Crash when closing report when used report navigator 0 0x00007fe062bdda64 in comphelper::OSelectionChangeMultiplexer::disposing(com::sun::star::lang::EventObject const&) (this=0x55fe72b7b680, _rSource=...) at comphelper/source/misc/SelectionMultiplex.cxx:82 1 0x00007fdf90a97a6b in comphelper::OInterfaceContainerHelper3<com::sun::star::view::XSelectionChangeListener>::disposeAndClear(com::sun::star::lang::EventObject const&) (this=0x55fe6c94b6d0, rEvt=...) at include/comphelper/interfacecontainer3.hxx:362 2 0x00007fdf90a6ace4 in rptui::OReportController::disposing() (this=0x55fe6c94b200) at reportdesign/source/ui/report/ReportController.cxx:341 3 0x00007fe062539b5d in cppu::WeakComponentImplHelperBase::dispose() (this=0x55fe6c94b200) at cppuhelper/source/implbase.cxx:104 4 0x00007fe0393b76e5 in cppu::PartialWeakComponentImplHelper<com::sun::star::frame::XDispatch, com::sun::star::frame::XDispatchProviderInterceptor, com::sun::star::util::XModifyListener, com::sun::star::frame::XFrameActionListener, com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo, com::sun::star::frame::XDispatchInformationProvider, com::sun::star::frame::XController2, com::sun::star::frame::XTitle, com::sun::star::frame::XTitleChangeBroadcaster, com::sun::star::awt::XUserInputInterception>::dispose() (this=0x55fe6c94b200) at include/cppuhelper/compbase.hxx:90 5 0x00007fe0393af9d3 in dbaui::OGenericUnoController::dispose() (this=0x55fe6c94b200) at dbaccess/source/ui/browser/genericcontroller.cxx:1207 See full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=181994 "addSelectionChangeListener" is called when "OSelectionChangeMultiplexer" is instantiated in "NavigatorTree" ctr 225 m_pSelectionListener = new OSelectionChangeMultiplexer(this,&m_rController); but "removeSelectionChangeListener" was never called so add the mechanism to call it. Change-Id: I157b147f7a17244dbbfa7d12743fc7d48e7d5f7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138773 Reviewed-by: Julien Nabet <serval2...@yahoo.fr> (cherry picked from commit fb8c86d95a7d1c68b6dc0f5bb2e00db2f40f58ab) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138551 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 41d1e848677891d1451b2120763c7c069006b4a5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138832 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/comphelper/source/misc/SelectionMultiplex.cxx b/comphelper/source/misc/SelectionMultiplex.cxx index 267266388c71..e4fb824a0ba3 100644 --- a/comphelper/source/misc/SelectionMultiplex.cxx +++ b/comphelper/source/misc/SelectionMultiplex.cxx @@ -95,7 +95,16 @@ void SAL_CALL OSelectionChangeMultiplexer::selectionChanged( const EventObject& m_pListener->_selectionChanged(_rEvent); } +void OSelectionChangeMultiplexer::dispose() +{ + osl_atomic_increment(&m_refCount); + { + Reference< XSelectionChangeListener> xPreventDelete(this); + m_xSet->removeSelectionChangeListener(xPreventDelete); + } + osl_atomic_decrement(&m_refCount); } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/SelectionMultiplex.hxx b/include/comphelper/SelectionMultiplex.hxx index 00ba7f955b09..328a96e9370a 100644 --- a/include/comphelper/SelectionMultiplex.hxx +++ b/include/comphelper/SelectionMultiplex.hxx @@ -81,6 +81,8 @@ namespace comphelper void unlock(); /// get the lock count sal_Int32 locked() const { return m_nLockCount; } + + void dispose(); }; diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index 939a6abc8236..d6a5ac60059d 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -238,6 +238,7 @@ NavigatorTree::~NavigatorTree() delete pData; return false; }); + m_pSelectionListener->dispose(); m_pReportListener->dispose(); }