]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
Common default datetime formats.
[wxWidgets.git] / src / common / event.cpp
index 2962ea721b2e10b9df2eed6b1464bb1e487430b0..55484498bb2926adc534c3a046e795e75e228ead 100644 (file)
@@ -1106,6 +1106,9 @@ void wxEvtHandler::ProcessPendingEvents()
     wxENTER_CRIT_SECT( *m_eventsLocker);
 #endif
 
+    // remember last event to process during this iteration
+    wxList::compatibility_iterator lastPendingNode = m_pendingEvents->GetLast();
+
     wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
     while ( node )
     {
@@ -1127,6 +1130,13 @@ void wxEvtHandler::ProcessPendingEvents()
         wxENTER_CRIT_SECT( *m_eventsLocker);
 #endif
 
+        // leave the loop once we have processed all events that were present
+        // at the start of ProcessPendingEvents because otherwise we could get
+        // into infinite loop if the pending event handler execution resulted
+        // in another event being posted
+        if ( node == lastPendingNode )
+            break;
+
         node = m_pendingEvents->GetFirst();
     }