Clean up XPCOM singleton constructor refcount handling

RESOLVED FIXED in Firefox 59

Status

()

enhancement
RESOLVED FIXED
2 years ago
Last year

People

(Reporter: kmag, Assigned: kmag)

Tracking

unspecified
mozilla59
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox59 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

2 years ago
This is a follow-up to bug 1409249. There are a lot of places where our factory singleton constructors either don't correctly handle their returned references being released by the component manager, or do handle it, but in ways that are not obvious.

This patch handles a few places where we can sometimes wind up with dangling singleton pointers, adds some explanatory comments and sanity check assertions, and replaces some uses of manual refcounting with StaticRefPtr and ClearOnShutdown.

There are still some places where we may wind up with odd behavior if the first QI for a getService call fails, and we wind up destroying the first instance of a service that we create, and re-creating a new one later.
Comment hidden (mozreview-request)

Comment 2

2 years ago
mozreview-review
Comment on attachment 8923230 [details]
Bug 1412726: Clean up XPCOM singleton constructor refcount handling.

https://reviewboard.mozilla.org/r/194390/#review216276

Sorry for taking so long to review this.  This all seems very reasonable.
Attachment #8923230 - Flags: review?(nfroyd) → review+
Assignee

Comment 3

Last year
https://hg.mozilla.org/integration/mozilla-inbound/rev/8357c080dccbe4c6aaba3d9e012b3262f45ff7f6
Bug 1412726: Clean up XPCOM singleton constructor refcount handling. r=froydnj

Comment 4

Last year
bugherder
https://hg.mozilla.org/mozilla-central/rev/8357c080dccb
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.