Closed Bug 490071 Opened 15 years ago Closed 15 years ago

nsTypedSelection cycle collection should traverse to mSelectionListeners

Categories

(Core :: DOM: Selection, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Keywords: memory-leak)

Attachments

(1 file)

I just got a leak monitor alert after closing a view-source window:

Leaks in window 0x20839d00:
[+] [leaked object] (20840b00) = [Object]
 [ ] timeout = 0
 [ ] notifySelectionChanged (20840b40, chrome://global/content/viewSource.js, 25-29) = [Function]

The leak went away after the next GC (I got a "reclaimed leak alert").

I can't figure out how to get this to happen again.


However, from looking at code, I'm willing to guess that it might not have happened in the first place if nsTypedSelection's cycle collection implementation traversed and unlinked its mSelectionListeners.
I'm not sure why peterv didn't do this in bug 471126.

We can also use this patch to address bug 471126 comment 20.
Attached patch patchSplinter Review
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
Attachment #374536 - Flags: superreview?(peterv)
Attachment #374536 - Flags: review?(peterv)
Attachment #374536 - Flags: superreview?(peterv)
Attachment #374536 - Flags: superreview+
Attachment #374536 - Flags: review?(peterv)
Attachment #374536 - Flags: review+
Comment on attachment 374536 [details] [diff] [review]
patch

I think I was worried about selection listeners not getting notifications of the removal of the ranges. I guess we can try it out.
BTW, I don't think the notifications from the removal of the ranges in unlink is a problem, because unlink happens from the GC callback for JSGC_END.
http://hg.mozilla.org/mozilla-central/rev/443174a68358
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
OS: Linux → All
Priority: -- → P4
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: