nsTimeout-GCObject
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 162 3ae1ca70680d55840cbf5a60088ebaebfe2bddc5
permissions -rw-r--r--
State as of now

* * *

diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp
--- a/dom/src/base/nsGlobalWindow.cpp
+++ b/dom/src/base/nsGlobalWindow.cpp
@@ -568,24 +568,8 @@ nsTimeout::nsTimeout()
 #endif
 
   memset(this, 0, sizeof(*this));
-
-  MOZ_COUNT_CTOR(nsTimeout);
-}
-
-nsTimeout::~nsTimeout()
-{
-#ifdef DEBUG_jst
-  {
-    extern int gTimeoutCnt;
-
-    --gTimeoutCnt;
-  }
-#endif
-
-  MOZ_COUNT_DTOR(nsTimeout);
-}
-
-  
+}
+
 //*****************************************************************************
 //***    nsGlobalWindow: Object Management
 //*****************************************************************************
@@ -7565,7 +7549,7 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
 
   nsTimeout *nextTimeout, *timeout;
   nsTimeout *last_expired_timeout, *last_insertion_point;
-  nsTimeout dummy_timeout;
+  nsTimeout &dummy_timeout = *new nsTimeout();
   PRUint32 firingDepth = mTimeoutFiringDepth + 1;
 
   // Make sure that the window and the script context don't go away as
diff --git a/dom/src/base/nsGlobalWindow.h b/dom/src/base/nsGlobalWindow.h
--- a/dom/src/base/nsGlobalWindow.h
+++ b/dom/src/base/nsGlobalWindow.h
@@ -145,10 +145,9 @@ NS_CreateJSTimeoutHandler(nsGlobalWindow
  * timeout.  Holds a strong reference to an nsIScriptTimeoutHandler, which
  * abstracts the language specific cruft.
  */
-struct nsTimeout : PRCList
+struct nsTimeout : XPCOMGCObject, PRCList
 {
   nsTimeout();
-  ~nsTimeout();
 
   nsrefcnt Release();
   nsrefcnt AddRef();