Kaydet (Commit) 7aae8772 authored tarafından Michael Meeks's avatar Michael Meeks

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 b9f95769
......@@ -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))
......
......@@ -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)
......
......@@ -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;
}
}
......
......@@ -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;
}
......
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