X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/455f7c8205e5dc29d99026b158ae0a394dccc839..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/motif/dialog.cpp?ds=inline diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index ceb4ca922e..9291ad72fb 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -62,8 +62,6 @@ extern wxList wxModelessWindows; // Frames and modeless dialogs #define wxUSE_INVISIBLE_RESIZE 1 -IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow) - wxDialog::wxDialog() { m_modalShowing = false; @@ -181,7 +179,10 @@ void wxDialog::SetModal(bool flag) wxDialog::~wxDialog() { - m_isBeingDeleted = true; + SendDestroyEvent(); + + // if the dialog is modal, this will end its event loop + Show(false); delete m_eventLoop; @@ -241,6 +242,9 @@ bool wxDialog::Show( bool show ) if( !wxWindowBase::Show( show ) ) return false; + if ( !show && IsModal() ) + EndModal(wxID_CANCEL); + m_isShown = show; if (show) @@ -301,8 +305,7 @@ int wxDialog::ShowModal() // 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.