Unbind events when destroying wxTextEntryHintData

Leaving these event handlers bound resulted in crashes due to
dereferencing the already destroyed wxTextEntryHintData object.

Closes #17944.
This commit is contained in:
Tim Kosse
2017-09-04 22:28:32 +02:00
committed by Vadim Zeitlin
parent 6527607af7
commit 808c842edd

View File

@@ -51,7 +51,12 @@ public:
win->Bind(wxEVT_TEXT, &wxTextEntryHintData::OnTextChanged, this);
}
// default dtor is ok
~wxTextEntryHintData()
{
m_win->Unbind(wxEVT_SET_FOCUS, &wxTextEntryHintData::OnSetFocus, this);
m_win->Unbind(wxEVT_KILL_FOCUS, &wxTextEntryHintData::OnKillFocus, this);
m_win->Unbind(wxEVT_TEXT, &wxTextEntryHintData::OnTextChanged, this);
}
// Get the real text of the control such as it was before we replaced it
// with the hint.