Closed Bug 1617628 Opened 1 year ago Closed 1 year ago

Hide base class Put overloads in nsRefPtrHashtable to avoid implicit refcounting

Categories

(Core :: XPCOM, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: sg, Assigned: sg)

Details

Attachments

(1 file)

Within https://phabricator.services.mozilla.com/D63865#inline-383441, it turned out that nsRefPtrHashtable::Put might be called with a RefPtr being implicitly cast into a raw pointer, where moving it might actually be intended or at least possible. This is because the nsBaseHashtable::Put overloads are explicitly made visible by https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/xpcom/ds/nsRefPtrHashtable.h#54

It would be desirable to hide these overloads to avoid unintentional refcounting.

There actually are several places in the current code base where a RefPtr could be moved, which will be fixed as part of this bug.

Status: NEW → ASSIGNED
Attachment #9128538 - Attachment description: Bug 1617628 - Hide nsBaseHashtable Put overloads in nsRefPtrHashtable subclass. → Bug 1617628 - Hide nsBaseHashtable Put overloads in nsRefPtrHashtable subclass. r=froydnj
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/76383a875678
Hide nsBaseHashtable Put overloads in nsRefPtrHashtable subclass. r=froydnj
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/b6948968da8c
Port "Hide nsBaseHashtable Put overloads in nsRefPtrHashtable subclass" to Thunderbird  rs=bustage-fix
You need to log in before you can comment on or make changes to this bug.