[Libreoffice-commits] core.git: vcl/CppunitTest_vcl_lifecycle.mk vcl/qa vcl/source

Michael Meeks michael.meeks at collabora.com
Fri Jun 5 12:45:41 PDT 2015


 vcl/CppunitTest_vcl_lifecycle.mk |    2 ++
 vcl/qa/cppunit/lifecycle.cxx     |    8 ++++----
 vcl/source/app/svapp.cxx         |    4 ++--
 vcl/source/window/window.cxx     |    6 +++++-
 4 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 7aae8772aa18744cb1bbd8348272be99cc882c47
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Jun 5 16:37:49 2015 +0100

    Clear VclPtr instance reference on removed UserEvents.
    
    Also extend VclPtr lifecycle test.
    
    Change-Id: I4d989375ca02327216eb1f37e466aefdb733579d
    Reviewed-on: https://gerrit.libreoffice.org/16107
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/CppunitTest_vcl_lifecycle.mk b/vcl/CppunitTest_vcl_lifecycle.mk
index 54d4aff..ca79b00 100644
--- a/vcl/CppunitTest_vcl_lifecycle.mk
+++ b/vcl/CppunitTest_vcl_lifecycle.mk
@@ -45,6 +45,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_lifecycle,\
 	configmgr/source/configmgr \
 	i18npool/util/i18npool \
 	ucb/source/core/ucb1 \
+	ucb/source/ucp/file/ucpfile1 \
+	framework/util/fwk \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_lifecycle))
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index afc77b3..3b78d53 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -19,6 +19,7 @@
 #include <vcl/tabctrl.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/layout.hxx>
+#include <vcl/svapp.hxx>
 
 class LifecycleTest : public test::BootstrapFixture
 {
@@ -247,6 +248,7 @@ void LifecycleTest::testLeakage()
     // Create objects
     aObjects.push_back(LeakTestObject::Create<WorkWindow>(nullptr, WB_APP|WB_STDWORK));
     VclPtr<vcl::Window> xParent = aObjects.back()->getRef();
+
     aObjects.push_back(LeakTestObject::Create<PushButton>(xParent));
     aObjects.push_back(LeakTestObject::Create<OKButton>(xParent));
     aObjects.push_back(LeakTestObject::Create<CancelButton>(xParent));
@@ -256,20 +258,18 @@ void LifecycleTest::testLeakage()
     aObjects.push_back(LeakTestObject::Create<ComboBox>(xParent));
     aObjects.push_back(LeakTestObject::Create<RadioButton>(xParent));
 
-#if 0
     { // something that looks like a dialog
         aObjects.push_back(LeakTestObject::Create<Dialog>(xParent,WB_CLIPCHILDREN|WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEABLE));
         VclPtr<vcl::Window> xDlgParent = aObjects.back()->getRef();
-
         aObjects.push_back(LeakTestObject::Create<VclVBox>(xDlgParent));
         VclPtr<vcl::Window> xVBox = aObjects.back()->getRef();
-
         aObjects.push_back(LeakTestObject::Create<VclVButtonBox>(xVBox));
     }
 
+#if 0 // FIXME - would be good to get internal paths working.
     aObjects.push_back(LeakTestObject::Create<ModelessDialog>(xParent, "PrintProgressDialog", "vcl/ui/printprogressdialog.ui"));
-    aObjects.push_back(LeakTestObject::Create<ModalDialog>(xParent));
 #endif
+    aObjects.push_back(LeakTestObject::Create<ModalDialog>(xParent));
     xParent.clear();
 
     for (auto i = aObjects.rbegin(); i != aObjects.rend(); ++i)
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 0fe915f..97621a5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -939,9 +939,9 @@ void Application::RemoveUserEvent( ImplSVEvent * nUserEvent )
         {
             if( ! nUserEvent->maDelData.IsDead() )
                 nUserEvent->mpWindow->ImplRemoveDel( &(nUserEvent->maDelData) );
-            nUserEvent->mpWindow = NULL;
+            nUserEvent->mpWindow.clear();
         }
-
+        nUserEvent->mpInstanceRef.clear();
         nUserEvent->mbCall = false;
     }
 }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 8875195..77087aa 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -486,12 +486,14 @@ void Window::dispose()
     if ( pSVData->maWinData.mpLastDeacWin == this )
         pSVData->maWinData.mpLastDeacWin = NULL;
 
-    if ( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
+    if ( mpWindowImpl->mpFrameData )
     {
         if ( mpWindowImpl->mpFrameData->mnFocusId )
             Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
+        mpWindowImpl->mpFrameData->mnFocusId = NULL;
         if ( mpWindowImpl->mpFrameData->mnMouseMoveId )
             Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId );
+        mpWindowImpl->mpFrameData->mnMouseMoveId = NULL;
     }
 
     // release SalGraphics
@@ -558,6 +560,8 @@ void Window::dispose()
         }
         mpWindowImpl->mpFrame->SetCallback( NULL, NULL );
         pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
+        assert (mpWindowImpl->mpFrameData->mnFocusId == NULL);
+        assert (mpWindowImpl->mpFrameData->mnMouseMoveId == NULL);
         delete mpWindowImpl->mpFrameData;
     }
 


More information about the Libreoffice-commits mailing list