diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-03 17:15:20 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-08 06:40:25 +0000 |
commit | 80c874dc87ad3018df6e6f0edb7cca174f75db37 (patch) | |
tree | fa119fc641f9708332a0d931533684bab07c9e87 | |
parent | 7fb70ff650ce3a1e4a39bd1b936f511d6be8986c (diff) |
remove "object is disposed" warning in OBroadcastHelperVar::removeListener
doesn't add anything of value.
Change-Id: Ie2dea7c43570640284771c992d0072ab61de425e
Reviewed-on: https://gerrit.libreoffice.org/25871
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | cppuhelper/source/implbase.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppIconControl.cxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/sbagrid.hxx | 3 | ||||
-rw-r--r-- | include/cppuhelper/interfacecontainer.h | 1 | ||||
-rw-r--r-- | include/svtools/transfer.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/tabcont.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/dlg/LayerTabBar.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/inc/LayerTabBar.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/TabControl.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/sdwindow.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/tabcontr.cxx | 8 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 1 | ||||
-rw-r--r-- | svtools/source/brwbox/brwbox1.cxx | 2 | ||||
-rw-r--r-- | svtools/source/brwbox/datwin.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/transfer2.cxx | 31 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 2 |
22 files changed, 90 insertions, 10 deletions
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx index 147fe822c091..32526450b8b8 100644 --- a/cppuhelper/source/implbase.cxx +++ b/cppuhelper/source/implbase.cxx @@ -284,7 +284,10 @@ void WeakAggComponentImplHelperBase::removeEventListener( Reference< lang::XEventListener > const & xListener ) throw (RuntimeException, std::exception) { - rBHelper.removeListener( cppu::UnoType<decltype(xListener)>::get(), xListener ); + // if we have disposed, then we have cleared the list already + MutexGuard aGuard( rBHelper.rMutex ); + if (!rBHelper.bDisposed) + rBHelper.removeListener( cppu::UnoType<decltype(xListener)>::get(), xListener ); } } diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx index 1298cc987893..14d623485f52 100644 --- a/dbaccess/source/ui/app/AppIconControl.cxx +++ b/dbaccess/source/ui/app/AppIconControl.cxx @@ -77,6 +77,7 @@ void OApplicationIconControl::dispose() pEntry->SetUserData(nullptr); } } + DropTargetHelper::dispose(); SvtIconChoiceCtrl::dispose(); } diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 1ae5e20af098..226eaaea6c2c 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -562,6 +562,17 @@ SbaGridHeader::SbaGridHeader(BrowseBox* pParent, WinBits nWinBits) { } +SbaGridHeader::~SbaGridHeader() +{ + disposeOnce(); +} + +void SbaGridHeader::dispose() +{ + DragSourceHelper::dispose(); + FmGridHeader::dispose(); +} + void SbaGridHeader::StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) { SolarMutexGuard aGuard; diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx index 5565311196aa..1972692121b5 100644 --- a/dbaccess/source/ui/inc/sbagrid.hxx +++ b/dbaccess/source/ui/inc/sbagrid.hxx @@ -170,7 +170,8 @@ namespace dbaui { public: SbaGridHeader(BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG); - + virtual void dispose() override; + virtual ~SbaGridHeader(); protected: // FmGridHeader overridables diff --git a/include/cppuhelper/interfacecontainer.h b/include/cppuhelper/interfacecontainer.h index f3986bb5776c..07b296e5b7d2 100644 --- a/include/cppuhelper/interfacecontainer.h +++ b/include/cppuhelper/interfacecontainer.h @@ -476,7 +476,6 @@ struct OBroadcastHelperVar const css::uno::Reference < css::uno::XInterface > & r ) { ::osl::MutexGuard guard( rMutex ); - OSL_ENSURE( !bDisposed, "object is disposed" ); if( ! bInDispose && ! bDisposed ) aLC.removeInterface( key , r ); } diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx index ea50c8eaa2fd..37aaf4d16093 100644 --- a/include/svtools/transfer.hxx +++ b/include/svtools/transfer.hxx @@ -395,8 +395,9 @@ private: friend class DragSourceHelper::DragGestureListener; private: - + osl::Mutex maMutex; css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer; + css::uno::Reference< css::datatransfer::dnd::XDragGestureListener > mxDragGestureListener; DragSourceHelper& operator=( const DragSourceHelper& rDragSourceHelper ) = delete; @@ -408,6 +409,7 @@ public: virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); DragSourceHelper( vcl::Window* pWindow ); + void dispose(); virtual ~DragSourceHelper(); }; @@ -444,8 +446,9 @@ private: friend class DropTargetHelper::DropTargetListener; private: - + osl::Mutex maMutex; css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget; + css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > mxDropTargetListener; DataFlavorExVector* mpFormats; @@ -468,6 +471,7 @@ public: DropTargetHelper( vcl::Window* pWindow ); DropTargetHelper( const css::uno::Reference< css::datatransfer::dnd::XDropTarget >& rxDropTarget ); + void dispose(); virtual ~DropTargetHelper(); // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 904c4651af9a..e7d4d96b7d90 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1440,6 +1440,7 @@ void ScTextWnd::dispose() delete pEditEngine; pEditEngine = nullptr; + DragSourceHelper::dispose(); ScTextWndBase::dispose(); } diff --git a/sc/source/ui/inc/tabcont.hxx b/sc/source/ui/inc/tabcont.hxx index 31503b49eaf3..e6f2df06318d 100644 --- a/sc/source/ui/inc/tabcont.hxx +++ b/sc/source/ui/inc/tabcont.hxx @@ -64,6 +64,7 @@ protected: public: ScTabControl( vcl::Window* pParent, ScViewData* pData ); + virtual void dispose() override; virtual ~ScTabControl(); using TabBar::StartDrag; diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 8f8eb13eb036..56ef3b602b26 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -111,6 +111,14 @@ IMPL_LINK_TYPED(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void) ScTabControl::~ScTabControl() { + disposeOnce(); +} + +void ScTabControl::dispose() +{ + DragSourceHelper::dispose(); + DropTargetHelper::dispose(); + TabBar::dispose(); } sal_uInt16 ScTabControl::GetMaxId() const diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx index caf7ce513c8c..8f8425b88a6a 100644 --- a/sd/source/ui/dlg/LayerTabBar.cxx +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -57,6 +57,13 @@ LayerTabBar::LayerTabBar(DrawViewShell* pViewSh, vcl::Window* pParent) LayerTabBar::~LayerTabBar() { + disposeOnce(); +} + +void LayerTabBar::dispose() +{ + DropTargetHelper::dispose(); + TabBar::dispose(); } void LayerTabBar::Select() diff --git a/sd/source/ui/inc/LayerTabBar.hxx b/sd/source/ui/inc/LayerTabBar.hxx index 35dbd1833871..ac2fab525ce0 100644 --- a/sd/source/ui/inc/LayerTabBar.hxx +++ b/sd/source/ui/inc/LayerTabBar.hxx @@ -38,6 +38,7 @@ public: LayerTabBar ( DrawViewShell* pDrViewSh, vcl::Window* pParent); + virtual void dispose() override; virtual ~LayerTabBar(); /** Inform all listeners of this control that the current layer has been diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx index 6054b441f3e5..53e762252b36 100644 --- a/sd/source/ui/inc/TabControl.hxx +++ b/sd/source/ui/inc/TabControl.hxx @@ -40,6 +40,7 @@ class TabControl sal_uInt16 RrePageID; public: TabControl (DrawViewShell* pDrViewSh, vcl::Window* pParent); + virtual void dispose() override; virtual ~TabControl(); /** Inform all listeners of this control that the current page has been diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 539cee5c083a..f9ba5cf6caba 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -200,6 +200,8 @@ void LayoutMenu::dispose() { SAL_INFO("sd.ui", "destroying LayoutMenu at " << this); Dispose(); + DragSourceHelper::dispose(); + DropTargetHelper::dispose(); ValueSet::dispose(); } diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 97c4a5d92c85..2a40cf3e3f38 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -102,6 +102,7 @@ void Window::dispose() pWindowUpdater->UnregisterWindow (this); } mpShareWin.clear(); + DropTargetHelper::dispose(); vcl::Window::dispose(); } diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index f258d59828e6..34627e7faf92 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -78,6 +78,14 @@ TabControl::TabControl(DrawViewShell* pViewSh, vcl::Window* pParent) : TabControl::~TabControl() { + disposeOnce(); +} + +void TabControl::dispose() +{ + DragSourceHelper::dispose(); + DropTargetHelper::dispose(); + TabBar::dispose(); } void TabControl::Select() diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 2186e997cd80..ba9fda42b4c9 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -149,6 +149,7 @@ void SmEditWindow::dispose() pVScrollBar.disposeAndClear(); pScrollBox.disposeAndClear(); + DropTargetHelper::dispose(); vcl::Window::dispose(); } diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 16cbb639603c..37deeb509c49 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -162,6 +162,8 @@ void BrowseBox::dispose() delete pColSel; if ( bMultiSelection ) delete uRow.pSel; + DragSourceHelper::dispose(); + DropTargetHelper::dispose(); Control::dispose(); } diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index 11b43f6a92e6..d15817bf2322 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -229,6 +229,8 @@ void BrowserDataWin::dispose() pHeaderBar.clear(); pEventWin.clear(); pCornerWin.clear(); + DragSourceHelper::dispose(); + DropTargetHelper::dispose(); Control::dispose(); } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 29b5ee1d0ba5..6021d6b1ea3e 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1481,6 +1481,8 @@ void SvTreeListBox::dispose() mpImpl.reset(); } + DropTargetHelper::dispose(); + DragSourceHelper::dispose(); Control::dispose(); } diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 5b7a3daa7899..e8fcdc13e1b2 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -78,10 +78,21 @@ DragSourceHelper::DragSourceHelper( vcl::Window* pWindow ) : } +void DragSourceHelper::dispose() +{ + Reference<XDragGestureRecognizer> xTmp; + { + osl::MutexGuard aGuard( maMutex ); + xTmp = mxDragGestureRecognizer; + mxDragGestureRecognizer.clear(); + } + if( xTmp.is() ) + xTmp->removeDragGestureListener( mxDragGestureListener ); +} + DragSourceHelper::~DragSourceHelper() { - if( mxDragGestureRecognizer.is() ) - mxDragGestureRecognizer->removeDragGestureListener( mxDragGestureListener ); + dispose(); } @@ -240,11 +251,21 @@ DropTargetHelper::DropTargetHelper( const Reference< XDropTarget >& rxDropTarget } -DropTargetHelper::~DropTargetHelper() +void DropTargetHelper::dispose() { - if( mxDropTarget.is() ) - mxDropTarget->removeDropTargetListener( mxDropTargetListener ); + Reference< XDropTarget > xTmp; + { + osl::MutexGuard aGuard( maMutex ); + xTmp = mxDropTarget; + mxDropTarget.clear(); + } + if( xTmp.is() ) + xTmp->removeDropTargetListener( mxDropTargetListener ); +} +DropTargetHelper::~DropTargetHelper() +{ + dispose(); delete mpFormats; } diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 45a8fc4e1840..55c1b3acfa46 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -142,6 +142,7 @@ void FmGridHeader::dispose() { delete m_pImpl; m_pImpl = nullptr; + DropTargetHelper::dispose(); svt::EditBrowserHeader::dispose(); } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 434ab27ef89a..fafaf0ef3b41 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5158,6 +5158,8 @@ void SwEditWin::dispose() delete m_pFrameControlsManager; m_pFrameControlsManager = nullptr; + DragSourceHelper::dispose(); + DropTargetHelper::dispose(); vcl::Window::dispose(); } |