summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-06-05 16:37:49 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-06-05 19:45:12 +0000
commit7aae8772aa18744cb1bbd8348272be99cc882c47 (patch)
treec4824605af0def9fe11cb1c302f9b0e18993c06e /vcl
parentWaE: ‘<::’ cannot begin a template-argument list (diff)
downloadcore-7aae8772aa18744cb1bbd8348272be99cc882c47.tar.gz
core-7aae8772aa18744cb1bbd8348272be99cc882c47.zip
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@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/CppunitTest_vcl_lifecycle.mk2
-rw-r--r--vcl/qa/cppunit/lifecycle.cxx8
-rw-r--r--vcl/source/app/svapp.cxx4
-rw-r--r--vcl/source/window/window.cxx6
4 files changed, 13 insertions, 7 deletions
diff --git a/vcl/CppunitTest_vcl_lifecycle.mk b/vcl/CppunitTest_vcl_lifecycle.mk
index 54d4affc1ce0..ca79b0062ca1 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 afc77b3de78f..3b78d5346d19 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 0fe915fab6ce..97621a5b1c87 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 8875195c43a3..77087aa27f89 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;
}