]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix crash in wxMSW wxProgressDialog without wxPD_APP_MODAL style.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Sep 2010 13:33:36 +0000 (13:33 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Sep 2010 13:33:36 +0000 (13:33 +0000)
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

index 425e2a8cf8cd18f81efdae85e2993e24f94984d3..1e8bd48d6a2a58d34b8034e6e07387602ece7f61 100644 (file)
@@ -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.