[Libreoffice-commits] core.git: cppuhelper/source dbaccess/source include/cppuhelper include/svtools sc/source sd/source starmath/source svtools/source svx/source sw/source

Noel Grandin noel at peralex.com
Wed Jun 8 06:40:49 UTC 2016


 cppuhelper/source/implbase.cxx            |    5 +++-
 dbaccess/source/ui/app/AppIconControl.cxx |    1 
 dbaccess/source/ui/browser/sbagrid.cxx    |   11 ++++++++++
 dbaccess/source/ui/inc/sbagrid.hxx        |    3 +-
 include/cppuhelper/interfacecontainer.h   |    1 
 include/svtools/transfer.hxx              |    8 +++++--
 sc/source/ui/app/inputwin.cxx             |    1 
 sc/source/ui/inc/tabcont.hxx              |    1 
 sc/source/ui/view/tabcont.cxx             |    8 +++++++
 sd/source/ui/dlg/LayerTabBar.cxx          |    7 ++++++
 sd/source/ui/inc/LayerTabBar.hxx          |    1 
 sd/source/ui/inc/TabControl.hxx           |    1 
 sd/source/ui/sidebar/LayoutMenu.cxx       |    2 +
 sd/source/ui/view/sdwindow.cxx            |    1 
 sd/source/ui/view/tabcontr.cxx            |    8 +++++++
 starmath/source/edit.cxx                  |    1 
 svtools/source/brwbox/brwbox1.cxx         |    2 +
 svtools/source/brwbox/datwin.cxx          |    2 +
 svtools/source/contnr/treelistbox.cxx     |    2 +
 svtools/source/misc/transfer2.cxx         |   31 +++++++++++++++++++++++++-----
 svx/source/fmcomp/fmgridcl.cxx            |    1 
 sw/source/uibase/docvw/edtwin.cxx         |    2 +
 22 files changed, 90 insertions(+), 10 deletions(-)

New commits:
commit 80c874dc87ad3018df6e6f0edb7cca174f75db37
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jun 3 17:15:20 2016 +0200

    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 at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
index 147fe82..3252645 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 1298cc9..14d6234 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 1ae5e20..226eaae 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 5565311..1972692 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 f3986bb..07b296e 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 ea50c8e..37aaf4d 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 904c465..e7d4d96 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 31503b4..e6f2df0 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 8f8eb13..56ef3b6 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 caf7ce5..8f8425b 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 35dbd18..ac2fab5 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 6054b44..53e7622 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 539cee5..f9ba5cf6 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 97c4a5d..2a40cf3 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 f258d59..34627e7 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 2186e99..ba9fda4 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 16cbb63..37deeb5 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 11b43f6..d15817b 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 29b5ee1..6021d6b 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 5b7a3da..e8fcdc1 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 45a8fc4..55c1b3a 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 434ab27..fafaf0e 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();
 }
 


More information about the Libreoffice-commits mailing list