From c95f668b217720372b9d448d5b12520c8fca7337 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 13 Dec 2018 00:39:25 +0100 Subject: [PATCH] Fix use of dangling pointer in ButtonTestCase::Disabled() Fix the test added in dfec7aa0c08617ed61fc1ee04551aea19dc6abd0 which deleted the button pointer used by EventCounter by simply moving EventCounter initialization after the button re-creation. See #16385. --- tests/controls/buttontest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/controls/buttontest.cpp b/tests/controls/buttontest.cpp index 4f84523828..ffc4480f8c 100644 --- a/tests/controls/buttontest.cpp +++ b/tests/controls/buttontest.cpp @@ -98,8 +98,6 @@ void ButtonTestCase::Click() void ButtonTestCase::Disabled() { - EventCounter clicked(m_button, wxEVT_BUTTON); - wxUIActionSimulator sim; // In this test we disable the button and check events are not sent and we @@ -118,6 +116,8 @@ void ButtonTestCase::Disabled() m_button->Create(wxTheApp->GetTopWindow(), wxID_ANY, "wxButton"); } + EventCounter clicked(m_button, wxEVT_BUTTON); + sim.MouseMove(m_button->GetScreenPosition() + wxPoint(10, 10)); wxYield();