fix widget leak in LookupRegisteredPluginWindow

RESOLVED FIXED in Firefox 44

Status

()

Core
Widget
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: froydnj, Assigned: froydnj)

Tracking

unspecified
mozilla44
Points:
---

Firefox Tracking Flags

(firefox44 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
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.
(Assignee)

Comment 1

2 years ago
Created attachment 8669093 [details] [diff] [review]
fix widget leak in LookupRegisteredPluginWindow

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)
Attachment #8669093 - Flags: review?(roc) → review+

Comment 2

2 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/e54d330a1de6
https://hg.mozilla.org/mozilla-central/rev/e54d330a1de6
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox44: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.