Closed Bug 1210912 Opened 9 years ago Closed 9 years ago

fix widget leak in LookupRegisteredPluginWindow

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

nsRefPtrHashtable::Get follows XPCOM outparam rules, so it addrefs its
argument prior to returning it.  LookupRegisteredPluginWindow, however,
doesn't know anything about the additional reference, and neither does
anything else that calls it (which is, fortunately, not that much code).
So every widget returned by this function will leak.

To fix this, we use nsRefPtrHashtable::GetWeak, which doesn't addref its
argument, but merely returns the raw pointer, leaving the hashtable
responsible for the owning reference.
I *think* this is a real leak, though I find it a little difficult to imagine
that our tests haven't caught this...
Attachment #8669093 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/e54d330a1de6
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: