From e058b98d8a323e97fcac7a32fcb0a23ad438b595 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2001 00:10:51 +0000 Subject: [PATCH 1/1] don't use windows about to be destroyed as implicit dialog parent git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dialog.cpp | 2 +- src/gtk1/dialog.cpp | 2 +- src/msw/toplevel.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index d1d13da9b3..e948cddd10 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -198,7 +198,7 @@ int wxDialog::ShowModal() if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { wxWindow *parent = wxTheApp->GetTopWindow(); - if ( parent && parent != this ) + if ( parent && parent != this && parent->IsBeingDeleted() ) { m_parent = parent; gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) ); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index d1d13da9b3..e948cddd10 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -198,7 +198,7 @@ int wxDialog::ShowModal() if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { wxWindow *parent = wxTheApp->GetTopWindow(); - if ( parent && parent != this ) + if ( parent && parent != this && parent->IsBeingDeleted() ) { m_parent = parent; gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) ); diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 0720766612..8874a8d156 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -192,6 +192,12 @@ bool wxTopLevelWindowMSW::CreateDialog(const wxChar *dlgTemplate, if ( !parent && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { parent = wxTheApp->GetTopWindow(); + + // but don't use the window which is about to be destroyed as parent + if ( parent->IsBeingDeleted() ) + { + parent = NULL; + } } m_hWnd = (WXHWND)::CreateDialog(wxGetInstance(), -- 2.45.2