From 4e2a3778386d60356dab319afa2d3f987f86d6b2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Jun 2008 16:51:42 +0000 Subject: [PATCH] assert if ShowModal() is called after a previous Show() (#1416) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54321 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dialog.cpp | 7 ++----- src/msw/dialog.cpp | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index c70813d557..c61fbca515 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -98,11 +98,8 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) int wxDialog::ShowModal() { - if (IsModal()) - { - wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); - return GetReturnCode(); - } + wxASSERT_MSG( !IsModal(), "ShowModal() can't be called twice" ); + wxASSERT_MSG( !IsShown(), "ShowModal() can't be called after Show()" ); // release the mouse if it's currently captured as the window having it // will be disabled when this dialog is shown -- but will still keep the diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 9d28a6e039..b0703f2291 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -283,7 +283,8 @@ void wxDialog::Raise() // show dialog modally int wxDialog::ShowModal() { - wxASSERT_MSG( !IsModal(), _T("wxDialog::ShowModal() reentered?") ); + wxASSERT_MSG(!IsShown(), + _T("ShowModal() can't be called for an already shown dialog")); m_endModalCalled = false; -- 2.45.2