From a5655d37db9baabce654849fd66173f95f74e230 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Sep 2010 13:33:36 +0000 Subject: [PATCH] Fix crash in wxMSW wxProgressDialog without wxPD_APP_MODAL style. Use the correct method to retrieve the parent window to disable and check that this pointer is not NULL before dereferencing it. Closes #12414. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/progdlg.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index 425e2a8cf8..1e8bd48d6a 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -628,7 +628,18 @@ bool wxProgressDialog::Show(bool show) } if ( !HasFlag(wxPD_APP_MODAL) ) - GetParent()->Disable(); + { + wxWindow * const parent = GetTopParent(); + if ( parent ) + { + parent->Disable(); + } + else + { + wxFAIL_MSG( "Progress dialog must have a valid parent if " + "wxPD_APP_MODAL is not used." ); + } + } //else: otherwise all windows will be disabled by m_taskDialogRunner // Do not show the underlying dialog. -- 2.45.2