Bug 481955 - Crash [@ nsGlobalWindow::ResumeTimeouts], r=bent, sr=jst
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sun, 08 Mar 2009 14:55:15 +0200
changeset 25838 dbfc5db244d0d37c0f92cea67b08a64ffb39979a
parent 25837 537eccc6c218015a1977e07df16e3872ee359e1c
child 25839 9ab865986f27f29566f102ad5ee9a51e273c7f25
push idunknown
push userunknown
push dateunknown
reviewersbent, jst
bugs481955
milestone1.9.2a1pre
Bug 481955 - Crash [@ nsGlobalWindow::ResumeTimeouts], r=bent, sr=jst
dom/src/base/nsGlobalWindow.cpp
--- a/dom/src/base/nsGlobalWindow.cpp
+++ b/dom/src/base/nsGlobalWindow.cpp
@@ -7879,25 +7879,25 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
     }
 
     // Running a timeout can cause another timeout to be deleted, so
     // we need to reset the pointer to the following timeout.
     nextTimeout = timeout->Next();
 
     PR_REMOVE_LINK(timeout);
 
-    // Release the timeout struct since it's out of the list
-    timeout->Release();
-
     if (isInterval) {
       // Reschedule an interval timeout. Insert interval timeout
       // onto list sorted in deadline order.
-
+      // AddRefs timeout.
       InsertTimeoutIntoList(timeout);
     }
+
+    // Release the timeout struct since it's possibly out of the list
+    timeout->Release();
   }
 
   // Take the dummy timeout off the head of the list
   PR_REMOVE_LINK(&dummy_timeout);
 
   mTimeoutInsertionPoint = last_insertion_point;
 }