Forgetting to pop custom event handlers pushed onto the window before it is
destroyed will result in a crash later on, so try to detect this immediately
with an assert.
We might want to forcefully pop them off too, this could result in memory
leaks but would be still better than crashing.
Closes #11533.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63065
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// we weren't a dialog class
wxTopLevelWindows.DeleteObject((wxWindow*)this);
+ // Any additional event handlers should be popped before the window is
+ // deleted as otherwise the last handler will be left with a dangling
+ // pointer to this window result in a difficult to diagnose crash later on.
+ wxASSERT_MSG( GetEventHandler() == this,
+ wxT("any pushed event handlers must have been removed") );
+
#if wxUSE_MENUS
// The associated popup menu can still be alive, disassociate from it in
// this case