Closed Bug 609814 Opened 12 years ago Closed 12 years ago
Wrapper never unregisters as a shutdown observer (causing leaks, effectively)
SVGDocumentWrapper objects register as a shutdown observers, so that they can sever some ties just before shutdown (since they get torn down as part of imagelib, but they own stuff that's in gklayout, and I think imagelib gets torn down after gklayout). However -- bz just pointed out to me that SVGDocumentWrapper objects never *un*-register as shutdown observers. We need them to unregister, so that if their images are cleaned up before shutdown (the usual case), they can be GC'd correctly. Right now I guess the observer service holds a strong reference to them, which is keeping them alive forever.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
This patch makes SVGDocumentWrapper unregister as a shutdown observer in its destructor. To do that, we need to make it register as an observer using a weak reference (by passing PR_TRUE as the third param to AddObserver), so that it won't just live forever by virtue of being a shutdown-observer.
Attachment #488564 - Flags: review?(roc)
Attachment #488564 - Flags: review?(roc) → review+
Thanks for the review! Now just waiting on blocking-2.0+ before I can land this. (roc, mind granting that?)
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
It'd be cool if there were a way to test this kind of stuff.
I think that would require a new test framework (or an extension to an existing framework). That may be coming soon, though (?) -- it sounds like Jesse has some ideas here: http://www.squarefree.com/2010/11/14/detecting-leak-until-shutdown-bugs/
You need to log in before you can comment on or make changes to this bug.