[Libreoffice-commits] core.git: 7 commits - include/sfx2 include/svx sc/source sfx2/source svx/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jul 7 11:48:40 PDT 2015


 include/sfx2/childwin.hxx                    |    2 ++
 include/svx/SpellDialogChildWindow.hxx       |    2 +-
 sc/source/ui/inc/anyrefdg.hxx                |    2 +-
 sc/source/ui/miscdlgs/anyrefdg.cxx           |    5 +++++
 sfx2/source/appl/childwin.cxx                |   17 +++++++++++------
 svx/source/dialog/SpellDialogChildWindow.cxx |   16 ++++++++--------
 sw/source/uibase/dialog/wordcountwrapper.cxx |   10 +++++-----
 sw/source/uibase/inc/wordcountdialog.hxx     |    2 +-
 vcl/source/window/builder.cxx                |    1 +
 vcl/source/window/winproc.cxx                |    8 +++++---
 10 files changed, 40 insertions(+), 25 deletions(-)

New commits:
commit 2d06773762cae7d1cc98c723815a65b457a642c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 16:11:27 2015 +0100

    replace some IsDead with isDisposed
    
    keep both tests for now for cowardice
    
    Change-Id: I96d922ef64b874f2124204c3c564a38fa7511ffe

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index dbe7b91..5d73c49 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -739,11 +739,13 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool
             }
         }
 
-        if ( !aDelData.IsDead() )
-            aNEvt.GetWindow()->ImplNotifyKeyMouseCommandEventListeners( aNEvt );
+        assert(aNEvt.GetWindow() == pChild);
+
+        if (!pChild->isDisposed() || !aDelData.IsDead())
+            pChild->ImplNotifyKeyMouseCommandEventListeners( aNEvt );
     }
 
-    if ( aDelData.IsDead() )
+    if (pChild->isDisposed() || aDelData.IsDead())
         return true;
 
     if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
commit 4c9d7772bd76c30ddbfb7e0b3460aabb9529cfde
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 15:48:03 2015 +0100

    spelling dialog always leaked here
    
    Change-Id: I00c96bbfe7106a09c0a8aa09f3209537bc3d2b07

diff --git a/include/svx/SpellDialogChildWindow.hxx b/include/svx/SpellDialogChildWindow.hxx
index 2b4964f..2e7253f 100644
--- a/include/svx/SpellDialogChildWindow.hxx
+++ b/include/svx/SpellDialogChildWindow.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC SpellDialogChildWindow
     : public SfxChildWindow
 {
     friend class SpellDialog;
-    AbstractSpellDialog* m_pAbstractSpellDialog;
+    std::unique_ptr<AbstractSpellDialog> m_xAbstractSpellDialog;
 public:
     SpellDialogChildWindow (
         vcl::Window*pParent,
diff --git a/svx/source/dialog/SpellDialogChildWindow.cxx b/svx/source/dialog/SpellDialogChildWindow.cxx
index 7f580d8..181cede 100644
--- a/svx/source/dialog/SpellDialogChildWindow.cxx
+++ b/svx/source/dialog/SpellDialogChildWindow.cxx
@@ -35,10 +35,10 @@ SpellDialogChildWindow::SpellDialogChildWindow (
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     DBG_ASSERT(pFact, "SvxAbstractDialogFactory::Create() failed");
-    m_pAbstractSpellDialog = pFact->CreateSvxSpellDialog(_pParent,
+    m_xAbstractSpellDialog.reset(pFact->CreateSvxSpellDialog(_pParent,
                                             pBindings,
-                                            this );
-    pWindow = m_pAbstractSpellDialog->GetWindow();
+                                            this ));
+    pWindow = m_xAbstractSpellDialog->GetWindow();
     eChildAlignment = SfxChildAlignment::NOALIGNMENT;
     SetHideNotDelete(true);
 }
@@ -49,15 +49,15 @@ SpellDialogChildWindow::~SpellDialogChildWindow()
 
 SfxBindings& SpellDialogChildWindow::GetBindings() const
 {
-    OSL_ASSERT (m_pAbstractSpellDialog != NULL);
-    return m_pAbstractSpellDialog->GetBindings();
+    assert(m_xAbstractSpellDialog);
+    return m_xAbstractSpellDialog->GetBindings();
 }
 
 void SpellDialogChildWindow::InvalidateSpellDialog()
 {
-    OSL_ASSERT (m_pAbstractSpellDialog != NULL);
-    if(m_pAbstractSpellDialog)
-        m_pAbstractSpellDialog->Invalidate();
+    OSL_ASSERT (m_xAbstractSpellDialog);
+    if (m_xAbstractSpellDialog)
+        m_xAbstractSpellDialog->Invalidate();
 }
 
 bool SpellDialogChildWindow::HasAutoCorrection()
commit 3398b59d2dbdcafc7fd3e7446271c5dc3bd9b3be
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 14:36:42 2015 +0100

    AbstractSwWordCountFloatDlg always leaked here
    
    Change-Id: Icfff86678f6b9d85c0bc9bc77e450891d388cb2a

diff --git a/sw/source/uibase/dialog/wordcountwrapper.cxx b/sw/source/uibase/dialog/wordcountwrapper.cxx
index 119a0ea..1654667 100644
--- a/sw/source/uibase/dialog/wordcountwrapper.cxx
+++ b/sw/source/uibase/dialog/wordcountwrapper.cxx
@@ -23,9 +23,9 @@ SwWordCountWrapper::SwWordCountWrapper(   vcl::Window *pParentWindow,
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     assert(pFact && "SwAbstractDialogFactory fail!");
-    pAbstDlg = pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo);
-    assert(pAbstDlg && "Dialog construction failed!");
-    pWindow = pAbstDlg->GetWindow();
+    xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo));
+    assert(xAbstDlg && "Dialog construction failed!");
+    pWindow = xAbstDlg->GetWindow();
 
     eChildAlignment = SfxChildAlignment::NOALIGNMENT;
 }
@@ -38,12 +38,12 @@ SfxChildWinInfo SwWordCountWrapper::GetInfo() const
 
 void SwWordCountWrapper::UpdateCounts()
 {
-    pAbstDlg->UpdateCounts();
+    xAbstDlg->UpdateCounts();
 }
 
 void SwWordCountWrapper::SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat)
 {
-    pAbstDlg->SetCounts(rCurrCnt, rDocStat);
+    xAbstDlg->SetCounts(rCurrCnt, rDocStat);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx
index d4d9bde..1ac17c1 100644
--- a/sw/source/uibase/inc/wordcountdialog.hxx
+++ b/sw/source/uibase/inc/wordcountdialog.hxx
@@ -65,7 +65,7 @@ public:
 
 class SwWordCountWrapper : public SfxChildWindow
 {
-    AbstractSwWordCountFloatDlg*   pAbstDlg;
+    std::unique_ptr<AbstractSwWordCountFloatDlg> xAbstDlg;
 protected:
     SwWordCountWrapper(    vcl::Window *pParentWindow,
                             sal_uInt16 nId,
commit 47c41f4c03db2e876301760415db1e937d00f551
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 14:16:42 2015 +0100

    VclPtr: no dialog loaded from a .ui ever actually destructed
    
    Change-Id: I51a0596049a43cbc80f914f3d8491c2125c8109e

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 40d4614..dba80c0 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -543,6 +543,7 @@ void VclBuilder::disposeBuilder()
         delete aI->m_pMenu;
     }
     m_aMenus.clear();
+    m_pParent.clear();
 }
 
 void VclBuilder::handleTranslations(xmlreader::XmlReader &reader)
commit 3c6eec0d99a2bb84bd6719ad498d5de54dc959fe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 13:47:14 2015 +0100

    Related: tdf#92392 clear workwins that point to pWindow
    
    before trying to destroy pWindow
    
    Change-Id: I7257096e8da2a5d6753ad2091287d63ea9ae244b

diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index cffb5b6..e2a4c52 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -163,6 +163,8 @@ private:
                         GetContext() const
                         { return pContext; }
 
+    SAL_DLLPRIVATE void ClearWorkwin();
+
 protected:
                         SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId);
 
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 3346ac2..3c74643 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -177,12 +177,7 @@ void SfxChildWindow::Destroy()
 {
     if ( GetFrame().is() )
     {
-        if (pImp->pWorkWin)
-        {
-            if (pImp->pWorkWin->GetActiveChild_Impl() == pWindow)
-                pImp->pWorkWin->SetActiveChild_Impl(NULL);
-            pImp->pWorkWin = NULL;
-        }
+        ClearWorkwin();
         try
         {
             ::com::sun::star::uno::Reference < ::com::sun::star::util::XCloseable > xClose( GetFrame(), ::com::sun::star::uno::UNO_QUERY );
@@ -199,11 +194,21 @@ void SfxChildWindow::Destroy()
         delete this;
 }
 
+void SfxChildWindow::ClearWorkwin()
+{
+    if (pImp->pWorkWin)
+    {
+        if (pImp->pWorkWin->GetActiveChild_Impl() == pWindow)
+            pImp->pWorkWin->SetActiveChild_Impl(NULL);
+        pImp->pWorkWin = NULL;
+    }
+}
 
 SfxChildWindow::~SfxChildWindow()
 {
     delete pContext;
     pContext = NULL;
+    ClearWorkwin();
     pWindow.disposeAndClear();
     delete pImp;
     pImp = NULL;
commit 8e20a25319e16d2f74e18696480556bc841a1679
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 13:46:41 2015 +0100

    Related: tdf#92392 clear some more vclptrs on dispose
    
    Change-Id: I91b8d082ff19328e35e2f1c2a02838d96224dc9c

diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 3fcc966..c56cf72 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -83,6 +83,11 @@ void ScFormulaReferenceHelper::dispose()
         pInputHdl->ResetDelayTimer();   // stop the timer for disabling the input line
 
     pAccel.reset();
+
+    mpOldEditParent.clear();
+    m_pWindow.clear();
+    pRefBtn.clear();
+    pRefEdit.clear();
 }
 
 void ScFormulaReferenceHelper::enableInput( bool bEnable )
commit 5f216c82ab5fbab44ab55a5127d0be7d4a2da8e3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 7 16:29:45 2015 +0100

    Related: tdf#92392 protect against double dispose from dtor with disposeOnce
    
    Change-Id: I40f3bdea784a1abed8f9732a9444cd8d1eccf4a9

diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index c059ea9..8341ba8 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -278,7 +278,7 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef >
 
     ~ScRefHdlrImpl()
     {
-        dispose();
+        TBase::disposeOnce();
     }
 };
 


More information about the Libreoffice-commits mailing list