Fix use of dangling pointer in ButtonTestCase::Disabled()

Fix the test added in dfec7aa0c0 which
deleted the button pointer used by EventCounter by simply moving
EventCounter initialization after the button re-creation.

See #16385.
This commit is contained in:
Vadim Zeitlin 2018-12-13 00:39:25 +01:00
parent 141f0cb0e4
commit c95f668b21

View File

@ -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();