]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/progdlgg.cpp
implement wxStrtoX_l() variants even when wxHAS_XLOCALE_SUPPORT is not defined
[wxWidgets.git] / src / generic / progdlgg.cpp
index 6677a2ea33db11c7438f6cf9d1824415304452f7..ca8f0d5d617ed41d3ee741c461edc5854fd064d5 100644 (file)
@@ -403,8 +403,17 @@ wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
                 m_msg->SetLabel(_("Done."));
             }
 
+            wxCHECK_MSG(wxEventLoopBase::GetActive(), false,
+                        "wxProgressDialog::Update needs a running event loop");
+
+            // allow the window to repaint:
+            // NOTE: since we yield only for UI events with this call, there
+            //       should be no side-effects
             wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
 
+            // NOTE: this call results in a new event loop being created
+            //       and to a call to ProcessPendingEvents() (which may generate
+            //       unwanted re-entrancies).
             (void)ShowModal();
         }
         else // auto hide
@@ -451,8 +460,13 @@ bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip)
 
 bool wxProgressDialog::DoAfterUpdate(bool *skip)
 {
+    wxCHECK_MSG(wxEventLoopBase::GetActive(), false,
+                "wxProgressDialog::DoAfterUpdate needs a running event loop");
+
     // we have to yield because not only we want to update the display but
     // also to process the clicks on the cancel and skip buttons
+    // NOTE: using YieldFor() this call shouldn't give re-entrancy problems
+    //       for event handlers not interested to UI/user-input events.
     wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT);
 
     Update();
@@ -666,12 +680,18 @@ void wxProgressDialog::EnableClose()
 
 void wxProgressDialog::UpdateMessage(const wxString &newmsg)
 {
+    wxCHECK_RET(wxEventLoopBase::GetActive(),
+                "wxProgressDialog::UpdateMessage needs a running event loop");
+
     if ( !newmsg.empty() && newmsg != m_msg->GetLabel() )
     {
         m_msg->SetLabel(newmsg);
 
         Fit();   // adapt to the new label size
 
+        // allow the window to repaint:
+        // NOTE: since we yield only for UI events with this call, there
+        //       should be no side-effects
         wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
     }
 }