#define wxUSE_INVISIBLE_RESIZE 1
-IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
-
wxDialog::wxDialog()
{
m_modalShowing = false;
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
+
+ // if the dialog is modal, this will end its event loop
+ Show(false);
delete m_eventLoop;
if( !wxWindowBase::Show( show ) )
return false;
+ if ( !show && IsModal() )
+ EndModal(wxID_CANCEL);
+
m_isShown = show;
if (show)
// Now process all events in case they get sent to a destroyed dialog
wxFlushEvents( display );
- delete m_eventLoop;
- m_eventLoop = NULL;
+ wxDELETE(m_eventLoop);
// TODO: is it safe to call this, if the dialog may have been deleted
// by now? Probably only if we're using delayed deletion of dialogs.