From: Vadim Zeitlin Date: Tue, 22 Jun 2004 23:20:27 +0000 (+0000) Subject: fixed assertion failure if Ok or Cancel button is clicked in a modeless dialog (bug... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/12b58624e9975726334e2f9b2ee7f3e7b86595f0 fixed assertion failure if Ok or Cancel button is clicked in a modeless dialog (bug 973873) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27950 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index bbe72cdf87..879ae3a79d 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -113,6 +113,9 @@ protected: // common part of all ctors void Init(); + // end either modal or modeless dialog + void EndDialog(int rc); + private: wxWindow* m_oldFocus; bool m_endModalCalled; // allow for closing within InitDialog diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 5aee28f39c..edb0b0dab3 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -368,7 +368,15 @@ void wxDialog::EndModal(int retCode) m_endModalCalled = true; SetReturnCode(retCode); - Show(false); + Hide(); +} + +void wxDialog::EndDialog(int rc) +{ + if ( IsModal() ) + EndModal(rc); + else + Hide(); } // ---------------------------------------------------------------------------- @@ -380,7 +388,7 @@ void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { if ( Validate() && TransferDataFromWindow() ) { - EndModal(wxID_OK); + EndDialog(wxID_OK); } } @@ -394,7 +402,7 @@ void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event)) void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - EndModal(wxID_CANCEL); + EndDialog(wxID_CANCEL); } void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))