]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/progdlg.cpp
Initialize all fields of struct tm used by wxDateTime::Format().
[wxWidgets.git] / src / msw / progdlg.cpp
index b86f98986bc394ac0fe17750cb7cdfad3c18ff6c..0a016d382fe0909f2e5de288de6d9101982196d5 100644 (file)
@@ -100,16 +100,14 @@ public:
 class wxProgressDialogTaskRunner : public wxThread
 {
 public:
-    wxProgressDialogTaskRunner(wxWindow* parent)
-        : wxThread(wxTHREAD_JOINABLE),
-          m_parent(parent)
+    wxProgressDialogTaskRunner()
+        : wxThread(wxTHREAD_JOINABLE)
         { }
 
     wxProgressDialogSharedData* GetSharedDataObject()
         { return &m_sharedData; }
 
 private:
-    wxWindow* m_parent;
     wxProgressDialogSharedData m_sharedData;
 
     virtual void* Entry();
@@ -561,7 +559,7 @@ void wxProgressDialog::SetTitle(const wxString& title)
     }
 #endif // wxHAS_MSW_TASKDIALOG
 
-    return wxGenericProgressDialog::SetTitle(title);
+    wxGenericProgressDialog::SetTitle(title);
 }
 
 wxString wxProgressDialog::GetTitle() const
@@ -586,7 +584,7 @@ bool wxProgressDialog::Show(bool show)
 
         // We're showing the dialog for the first time, create the thread that
         // will manage it.
-        m_taskDialogRunner = new wxProgressDialogTaskRunner(GetParent());
+        m_taskDialogRunner = new wxProgressDialogTaskRunner;
         m_sharedData = m_taskDialogRunner->GetSharedDataObject();
 
         // Initialize shared data.
@@ -628,7 +626,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.