Closed Bug 407818 Opened 17 years ago Closed 17 years ago

Leak nsGenericDOMDataNode with <ol>, <li>, execCommand("selectall")

Categories

(Core :: DOM: Serializers, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: jruderman)

References

Details

(Keywords: memory-leak, testcase)

Attachments

(2 files, 1 obsolete file)

Attached file testcase
Loading the testcase makes Firefox leak an nsGenericDOMDataNode and some other stuff (as shown by trace-refcnt).  Patch coming up.
Attached patch patch (obsolete) — Splinter Review
The leak was due to
  currNode->GetPreviousSibling(&currNode);
because GetPreviousSibling addrefs before returning and currNode was a raw pointer.

This patch makes currNode be an nsCOMPtr. It also introduces a temporary because smaug and NeilAway say it's bad luck to do 
  obj->GetX(getter_AddRefs(obj));
(I guess you could lose your owning reference to the object before its method returns.)
Attachment #292501 - Flags: superreview?(dbaron)
Attachment #292501 - Flags: review?(dbaron)
Comment on attachment 292501 [details] [diff] [review]
patch

Two suggestions:

1) get rid of the variable |node| and just leave currNode -- initialize it the way node is now initialized.

2) move the declaration of |tmp| to one line above its first use.  Then it'll go out of scope much faster (less code generated for calling its destructor in various places) and hold unneeded references for less time.

r+sr=dbaron with that
Attachment #292501 - Flags: superreview?(dbaron)
Attachment #292501 - Flags: superreview+
Attachment #292501 - Flags: review?(dbaron)
Attachment #292501 - Flags: review+
Attachment #292501 - Attachment is obsolete: true
Attachment #292509 - Flags: superreview+
Attachment #292509 - Flags: review+
Attachment #292509 - Flags: approval1.9?
Attachment #292509 - Flags: approval1.9? → approval1.9+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Crashtest checked in.
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: