Bug 514061. Don't dispatch events while painting. r=jmathies
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 30 Nov 2009 18:14:04 -0500
changeset 35287 45f2a2271c733302bbd8ec9d9e5fe2dcffbe3e61
parent 35286 18633dc54642c882d9a957a1b521c4f6b80ce4ee
child 35288 1a0f2d658a4991769863b70a343bddb43124d0fc
push idunknown
push userunknown
push dateunknown
reviewersjmathies
bugs514061
milestone1.9.3a1pre
Bug 514061. Don't dispatch events while painting. r=jmathies
widget/src/windows/nsWindow.cpp
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -3108,16 +3108,22 @@ BOOL CALLBACK nsWindow::DispatchStarvedP
 // Check for pending paints and dispatch any pending paint
 // messages for any nsIWidget which is a descendant of the
 // top-level window that *this* window is embedded within.
 //
 // Note: We do not dispatch pending paint messages for non
 // nsIWidget managed windows.
 void nsWindow::DispatchPendingEvents()
 {
+  if (mPainting) {
+    NS_WARNING("We were asked to dispatch pending events during painting, "
+               "denying since that's unsafe.");
+    return;
+  }
+
   UpdateLastInputEventTime();
 
   // We need to ensure that reflow events do not get starved.
   // At the same time, we don't want to recurse through here
   // as that would prevent us from dispatching starved paints.
   static int recursionBlocker = 0;
   if (recursionBlocker++ == 0) {
     NS_ProcessPendingEvents(nsnull, PR_MillisecondsToInterval(100));