set m_isBeingDeleted to true (only) in SendDestroyEvent(); call it as early as possible during the window destruction to ensure that destroy event handlers can still access the full window object
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -209,7 +209,9 @@ wxWindowBase::wxWindowBase()
|
||||
// Whether we're using the current theme for this window (wxGTK only for now)
|
||||
m_themeEnabled = false;
|
||||
|
||||
// VZ: this one shouldn't exist...
|
||||
// This is set to true by SendDestroyEvent() which should be called by the
|
||||
// most derived class to ensure that the destruction event is sent as soon
|
||||
// as possible to allow its handlers to still see the undestroyed window
|
||||
m_isBeingDeleted = false;
|
||||
|
||||
m_freezeCount = 0;
|
||||
@@ -387,6 +389,16 @@ bool wxWindowBase::IsBeingDeleted() const
|
||||
|
||||
void wxWindowBase::SendDestroyEvent()
|
||||
{
|
||||
if ( m_isBeingDeleted )
|
||||
{
|
||||
// we could have been already called from a more derived class dtor,
|
||||
// e.g. ~wxTLW calls us and so does ~wxWindow and the latter call
|
||||
// should be simply ignored
|
||||
return;
|
||||
}
|
||||
|
||||
m_isBeingDeleted = true;
|
||||
|
||||
wxWindowDestroyEvent event;
|
||||
event.SetEventObject(this);
|
||||
event.SetId(GetId());
|
||||
|
Reference in New Issue
Block a user