Open
Bug 647998
Opened 14 years ago
Updated 2 years ago
Should assert when a not-yet-fired nsITimer is GCed
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: jruderman, Unassigned)
Details
See bug 640629 for the latest round of screw-ups.
I understand that we can't change the GC behavior of nsITimer right now. Can we at least make it assert-fail, so it doesn't just make pieces of the browser fail quietly and mysteriously? At least for one-shot timers?
Comment 1•14 years ago
|
||
I've never understood why we can't make timers root themselves while they are pending (and we're not shutting down)... can we just do that, and perhaps deal with the little bit of leak fallout that might happen?
![]() |
||
Comment 2•14 years ago
|
||
That seems fine offhand to me. Brendan, any reason not to do that?
Reporter | ||
Comment 3•14 years ago
|
||
Hrm, bug 387341 seems related.
I agree that the only sane model for timers is that they are rooted as long as they can fire in the future. It's terribly wrong for whether a timer fires or not to depend on the timing of GC.
We would have to audit users of repeating timers, at least, to make sure something cancels them. And obviously JS setTimeout/setInterval would have to cancel automatically when a window needs to go away.
![]() |
||
Comment 5•14 years ago
|
||
That last part works already: nsGlobalWindow::SetDocshell calls FreeInnerObjects on all the inners when aDocShell is null, and FreeInnerObjects calls ClearAllTimeouts, which cancels all the timer. This covers the "window closing" case. FreeInnerObjects is also called from nsGlobalWindow::SetNewDocument, which is what happens in the "navigating away" case.
![]() |
||
Updated•5 years ago
|
Component: General → XPCOM
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•