Closed Bug 1277405 Opened 8 years ago Closed 8 years ago

Places observers cause a shutdown leak when there are reference cycles

Categories

(Toolkit :: Places, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

Details

Attachments

(1 file)

nsNavHistory and nsNavBookmarks don't implement cycle collection, so if there are any reference cycles between observers and the services themselves, we get a shutdown leak and crash.

This currently happens if any global which references the download service also has a live downloads observer, since the download service registers a history observer for the lifetime of the process.
Blocks: 1272894
Please just do this where we set mCanNotify to false (we wouldn't notify from that point on...)
Also please make addObserver throw if mCanNotify is false...
(In reply to Marco Bonardo [::mak] from comment #2)
> Please just do this where we set mCanNotify to false (we wouldn't notify
> from that point on...)
> Also please make addObserver throw if mCanNotify is false...

I was assuming there was a reason that they weren't cleared at that point (namely preventing removeObserver from throwing if observers were cleared to early), but I'll do a full try run and see if it causes any problems.
Comment on attachment 8758938 [details]
Bug 1277405: Clear Places observers at XPCOM shutdown.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/57020/diff/1-2/
Attachment #8758938 - Attachment description: MozReview Request: Bug 1277405: Clear Places observers at XPCOM shutdown. r?mak → Bug 1277405: Clear Places observers at XPCOM shutdown.
Attachment #8758938 - Flags: review?(mak77)
Well, it didn't seem to cause any problems on try
Attachment #8758938 - Flags: review?(mak77) → review+
Comment on attachment 8758938 [details]
Bug 1277405: Clear Places observers at XPCOM shutdown.

https://reviewboard.mozilla.org/r/57020/#review54320

Thanks, it looks good!
https://hg.mozilla.org/mozilla-central/rev/0e6dfa8fc2f4
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: