Closed Bug 1412726 Opened 4 years ago Closed 3 years ago
Clean up XPCOM singleton constructor refcount handling
59 bytes, text/x-review-board-request
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 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+
https://hg.mozilla.org/integration/mozilla-inbound/rev/8357c080dccbe4c6aaba3d9e012b3262f45ff7f6 Bug 1412726: Clean up XPCOM singleton constructor refcount handling. r=froydnj
You need to log in before you can comment on or make changes to this bug.