X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fdf565feca722eddb84168a95dbef329ba23d719..9928536b3a83586c473c96000c2d3a32e4c3f576:/src/univ/dialog.cpp diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index 50fa18cacf..c98a5e91ac 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -53,6 +53,11 @@ void wxDialog::Init() wxDialog::~wxDialog() { + m_isBeingDeleted = true; + + // if the dialog is modal, this will end its event loop + Show(false); + delete m_eventLoop; } @@ -71,7 +76,7 @@ bool wxDialog::Create(wxWindow *parent, void wxDialog::OnApply(wxCommandEvent &WXUNUSED(event)) { - if ( Validate() ) + if ( Validate() ) TransferDataFromWindow(); } @@ -150,9 +155,12 @@ bool wxDialog::Show(bool show) EndModal(wxID_CANCEL); } + if (show && CanDoLayoutAdaptation()) + DoLayoutAdaptation(); + bool ret = wxDialogBase::Show(show); - if ( show ) + if ( show ) InitDialog(); return ret; @@ -175,7 +183,7 @@ int wxDialog::ShowModal() // forbidden if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { - wxWindow *parent = wxTheApp->GetTopWindow(); + wxWindow * const parent = GetParentForModalDialog(); if ( parent && parent != this ) { m_parent = parent;