Closed
Bug 289970
Opened 20 years ago
Closed 20 years ago
The sanitizing serializer leaks parsers
Categories
(Core :: DOM: Serializers, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mrbkap, Assigned: mrbkap)
Details
(Keywords: memory-leak)
Attachments
(1 file)
1.06 KB,
patch
|
mrbkap
:
review+
bzbarsky
:
superreview+
asa
:
approval1.8b2+
|
Details | Diff | Splinter Review |
When I made the patch for bug 254989, I didn't fully realize that there was a
cycle between the parser and the content sinks. Therefore, my patch introduced a
leak of the parser and the content sink (and the various classes used by both of
them). I have a patch that fixes the leak, which I will attach shortly.
Assignee | ||
Comment 1•20 years ago
|
||
This fixes the cycle by having the content sink let go of the parser when the
parser is done with it (it calls DidBuildModel() when it's done).
Attachment #180420 -
Flags: review?(ben.bucksch)
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•20 years ago
|
Attachment #180420 -
Flags: superreview?(bzbarsky)
![]() |
||
Updated•20 years ago
|
Attachment #180420 -
Flags: superreview?(bzbarsky) → superreview+
Comment 2•20 years ago
|
||
nsCOMPtr<nsIParser> temp(mParser); mParser = nsnull;
This looks iffy to me. Why is mParser = nsnull; insufficient? Doesn't that let
go of the reference? Alternatively a raw pointer and ADDREF/RELEASE?
I guess best would be a weak reference, if the parser is garanteed to be around
as long as you need it?
Anyways, all is fine with me. r=BenB.
Assignee | ||
Comment 3•20 years ago
|
||
Comment on attachment 180420 [details] [diff] [review]
fix the cycle
Marking this r+ based on comment 2 and requesting approval for 1.8b2 for this
leak fix.
Attachment #180420 -
Flags: review?(ben.bucksch)
Attachment #180420 -
Flags: review+
Attachment #180420 -
Flags: approval1.8b2?
Assignee | ||
Comment 4•20 years ago
|
||
Ben, the problem with just setting |mParser = nsnull| or using a weak ref, is
that the parser may go away before the content sink does, which could
potentially cause problems. In the case of not using the temp nsCOMPtr, the sink
could get deleted before the assignment to mParser takes place, which would crash.
Comment 5•20 years ago
|
||
Comment on attachment 180420 [details] [diff] [review]
fix the cycle
a=asa
Attachment #180420 -
Flags: approval1.8b2? → approval1.8b2+
Assignee | ||
Comment 6•20 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•