Don't send wxWindowDestroyEvent if we hadn't sent wxWindowCreateEvent.

Don't generate wxWindowDestroyEvent when destroying the windows that had been
never created for symmetry with wxWindowCreateEvent which wasn't sent for this
window neither.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-04-18 23:36:46 +00:00
parent 4af2a59fbf
commit 935594c16e

View File

@@ -554,6 +554,13 @@ void wxWindowBase::SendDestroyEvent()
bool wxWindowBase::Destroy()
{
// If our handle is invalid, it means that this window has never been
// created, either because creating it failed or, more typically, because
// this wxWindow object was default-constructed and its Create() method had
// never been called. As we didn't send wxWindowCreateEvent in this case
// (which is sent after successful creation), don't send the matching
// wxWindowDestroyEvent neither.
if ( GetHandle() )
SendDestroyEvent();
delete this;