[Libreoffice-commits] core.git: Branch 'feature/vclref' - 2 commits - sfx2/source vcl/source

Michael Meeks michael.meeks at collabora.com
Fri Mar 13 15:16:27 PDT 2015


 sfx2/source/appl/workwin.cxx |   11 +++++------
 sfx2/source/inc/workwin.hxx  |    2 +-
 vcl/source/window/window.cxx |    7 +++++++
 3 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 392f77ca7547d104b08cd4ded6a6b3ccfab6066b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Mar 13 22:20:44 2015 +0000

    add some more helpful paranoia to disposeOnce.
    
    Change-Id: I46f2bf5115f2b80990fdcac75bd31615c4221b9e

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index ad74ba0..423dd0e 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -142,6 +142,13 @@ void Window::disposeOnce()
     if (!mpWindowImpl || mpWindowImpl->mbInDispose)
         return;
     mpWindowImpl->mbInDispose = true;
+
+    // catch badness where our Window was not wrapped safely
+    // in a VclPtr cosily.
+    assert( mnRefCnt>0 );
+
+    // hold a ref in case something silly happens during dispose.
+    VclPtr<Window> aRef(this);
     dispose();
 }
 
commit 539d89b9b3f15f1cb284e401ed7d921364464140
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Mar 13 22:20:21 2015 +0000

    convert a problematic array to VclPtr.
    
    Change-Id: Ia8b6984a8a9bdf6f32cf5ebfc971a6921796eece

diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index e7246b6..cbe39da 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -606,7 +606,6 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow*
     m_aTbxTypeName( "private:resource/toolbar/" ),
     m_aProgressBarResName( "private:resource/progressbar/progressbar" )
 {
-    memset(pSplit, 0, sizeof(pSplit));
     DBG_ASSERT (pBindings, "No Bindings!");
 
     pBindings->SetWorkWindow_Impl( this );
@@ -633,10 +632,10 @@ SfxWorkWindow::~SfxWorkWindow()
     // Delete SplitWindows
     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
     {
-        SfxSplitWindow *p = pSplit[n];
+        VclPtr<SfxSplitWindow> p = pSplit[n];
         if (p->GetWindowCount())
             ReleaseChild_Impl(*p);
-        delete p;
+        pSplit[n].disposeAndClear();
     }
 
     // Delete help structure for Child-Windows
@@ -677,8 +676,8 @@ void SfxWorkWindow::DeleteControllers_Impl()
     for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
     {
         SfxSplitWindow *p = pSplit[n];
-           if (p->GetWindowCount())
-        p->Lock();
+        if (p->GetWindowCount())
+            p->Lock();
     }
 
     // Delete Child-Windows
@@ -2534,7 +2533,7 @@ bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin )
 {
     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
     {
-        if ( pSplit[n] != pSplitWin && pSplit[n]->IsAutoHide( true ) )
+        if ( pSplit[n].get() != pSplitWin && pSplit[n]->IsAutoHide( true ) )
             return true;
     }
     return false;
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index f222f11..2ed93bc 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -215,7 +215,7 @@ protected:
     Rectangle               aClientArea;
     Rectangle               aUpperClientArea;
     SfxWorkWindow*          pParent;
-    SfxSplitWindow*         pSplit[SFX_SPLITWINDOWS_MAX];
+    VclPtr<SfxSplitWindow>  pSplit[SFX_SPLITWINDOWS_MAX];
     SfxChildList_Impl       aChildren;
     SfxChildWindows_Impl    aChildWins;
     SfxBindings*            pBindings;


More information about the Libreoffice-commits mailing list