Kaydet (Commit) 3c7e6b06 authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Andras Timar

Clear VclPtr instance reference on removed UserEvents.

Also extend VclPtr lifecycle test.

Change-Id: I4d989375ca02327216eb1f37e466aefdb733579d
Reviewed-on: https://gerrit.libreoffice.org/16107Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 8c2188f0
...@@ -45,6 +45,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_lifecycle,\ ...@@ -45,6 +45,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_lifecycle,\
configmgr/source/configmgr \ configmgr/source/configmgr \
i18npool/util/i18npool \ i18npool/util/i18npool \
ucb/source/core/ucb1 \ ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
framework/util/fwk \
)) ))
$(eval $(call gb_CppunitTest_use_configuration,vcl_lifecycle)) $(eval $(call gb_CppunitTest_use_configuration,vcl_lifecycle))
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <vcl/tabctrl.hxx> #include <vcl/tabctrl.hxx>
#include <vcl/dialog.hxx> #include <vcl/dialog.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/svapp.hxx>
class LifecycleTest : public test::BootstrapFixture class LifecycleTest : public test::BootstrapFixture
{ {
...@@ -248,6 +249,7 @@ void LifecycleTest::testLeakage() ...@@ -248,6 +249,7 @@ void LifecycleTest::testLeakage()
// Create objects // Create objects
aObjects.push_back(LeakTestObject::Create<WorkWindow>(nullptr, WB_APP|WB_STDWORK)); aObjects.push_back(LeakTestObject::Create<WorkWindow>(nullptr, WB_APP|WB_STDWORK));
VclPtr<vcl::Window> xParent = aObjects.back()->getRef(); VclPtr<vcl::Window> xParent = aObjects.back()->getRef();
aObjects.push_back(LeakTestObject::Create<PushButton>(xParent)); aObjects.push_back(LeakTestObject::Create<PushButton>(xParent));
aObjects.push_back(LeakTestObject::Create<OKButton>(xParent)); aObjects.push_back(LeakTestObject::Create<OKButton>(xParent));
aObjects.push_back(LeakTestObject::Create<CancelButton>(xParent)); aObjects.push_back(LeakTestObject::Create<CancelButton>(xParent));
...@@ -257,20 +259,18 @@ void LifecycleTest::testLeakage() ...@@ -257,20 +259,18 @@ void LifecycleTest::testLeakage()
aObjects.push_back(LeakTestObject::Create<ComboBox>(xParent)); aObjects.push_back(LeakTestObject::Create<ComboBox>(xParent));
aObjects.push_back(LeakTestObject::Create<RadioButton>(xParent)); aObjects.push_back(LeakTestObject::Create<RadioButton>(xParent));
#if 0
{ // something that looks like a dialog { // something that looks like a dialog
aObjects.push_back(LeakTestObject::Create<Dialog>(xParent,WB_CLIPCHILDREN|WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEABLE)); aObjects.push_back(LeakTestObject::Create<Dialog>(xParent,WB_CLIPCHILDREN|WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEABLE));
VclPtr<vcl::Window> xDlgParent = aObjects.back()->getRef(); VclPtr<vcl::Window> xDlgParent = aObjects.back()->getRef();
aObjects.push_back(LeakTestObject::Create<VclVBox>(xDlgParent)); aObjects.push_back(LeakTestObject::Create<VclVBox>(xDlgParent));
VclPtr<vcl::Window> xVBox = aObjects.back()->getRef(); VclPtr<vcl::Window> xVBox = aObjects.back()->getRef();
aObjects.push_back(LeakTestObject::Create<VclVButtonBox>(xVBox)); 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<ModelessDialog>(xParent, "PrintProgressDialog", "vcl/ui/printprogressdialog.ui"));
aObjects.push_back(LeakTestObject::Create<ModalDialog>(xParent));
#endif #endif
aObjects.push_back(LeakTestObject::Create<ModalDialog>(xParent));
xParent.clear(); xParent.clear();
for (auto i = aObjects.rbegin(); i != aObjects.rend(); ++i) for (auto i = aObjects.rbegin(); i != aObjects.rend(); ++i)
......
...@@ -939,9 +939,9 @@ void Application::RemoveUserEvent( ImplSVEvent * nUserEvent ) ...@@ -939,9 +939,9 @@ void Application::RemoveUserEvent( ImplSVEvent * nUserEvent )
{ {
if( ! nUserEvent->maDelData.IsDead() ) if( ! nUserEvent->maDelData.IsDead() )
nUserEvent->mpWindow->ImplRemoveDel( &(nUserEvent->maDelData) ); nUserEvent->mpWindow->ImplRemoveDel( &(nUserEvent->maDelData) );
nUserEvent->mpWindow = NULL; nUserEvent->mpWindow.clear();
} }
nUserEvent->mpInstanceRef.clear();
nUserEvent->mbCall = false; nUserEvent->mbCall = false;
} }
} }
......
...@@ -486,12 +486,14 @@ void Window::dispose() ...@@ -486,12 +486,14 @@ void Window::dispose()
if ( pSVData->maWinData.mpLastDeacWin == this ) if ( pSVData->maWinData.mpLastDeacWin == this )
pSVData->maWinData.mpLastDeacWin = NULL; pSVData->maWinData.mpLastDeacWin = NULL;
if ( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData ) if ( mpWindowImpl->mpFrameData )
{ {
if ( mpWindowImpl->mpFrameData->mnFocusId ) if ( mpWindowImpl->mpFrameData->mnFocusId )
Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId ); Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
mpWindowImpl->mpFrameData->mnFocusId = NULL;
if ( mpWindowImpl->mpFrameData->mnMouseMoveId ) if ( mpWindowImpl->mpFrameData->mnMouseMoveId )
Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId ); Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId );
mpWindowImpl->mpFrameData->mnMouseMoveId = NULL;
} }
// release SalGraphics // release SalGraphics
...@@ -566,6 +568,8 @@ void Window::dispose() ...@@ -566,6 +568,8 @@ void Window::dispose()
} }
mpWindowImpl->mpFrame->SetCallback( NULL, NULL ); mpWindowImpl->mpFrame->SetCallback( NULL, NULL );
pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame ); pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
assert (mpWindowImpl->mpFrameData->mnFocusId == NULL);
assert (mpWindowImpl->mpFrameData->mnMouseMoveId == NULL);
delete mpWindowImpl->mpFrameData; delete mpWindowImpl->mpFrameData;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment