Closed Bug 1291019 Opened 8 years ago Closed 8 years ago

Get rid of spurious assert when NS_ReleaseOnMainThread() leaks late in shutdown

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: seth, Assigned: seth)

Details

Attachments

(1 file, 1 obsolete file)

It is a sad reality that we sometimes end up trying to NS_ReleaseOnMainThread() stuff late in shutdown. If |aAlwaysProxy| is true and we're late enough in shutdown that NS_GetMainThread() doesn't work, currently we don't just leak - we actually assert, because we don't take the value of |aDoomed|, and already_AddRefed asserts that we did in its destructor.

IMO, if we want to assert here, we should add an explicit assert, but we shouldn't trigger an accidental assert in unrelated code. I ran into this recently and it slowed down the process of debugging the actual problem because of the misleading assert.
Here's the patch. Let's take |aDoomed|'s pointer to make ~already_AddRefed() happy.
Attachment #8776702 - Flags: review?(nfroyd)
Comment on attachment 8776702 [details] [diff] [review]
Take the value of |aDoomed| in NS_ReleaseOnMainThread() if we're going to leak anyway.

Review of attachment 8776702 [details] [diff] [review]:
-----------------------------------------------------------------

For the record, seth and I discussed over IRC and he's going to write up a version of the patch with an explicit assert.
Attachment #8776702 - Flags: review?(nfroyd)
Per our discussion on IRC, this updated version of the patch adds an explicit
assert.
Attachment #8776728 - Flags: review?(nfroyd)
Attachment #8776702 - Attachment is obsolete: true
Comment on attachment 8776728 [details] [diff] [review]
Take the value of |aDoomed| in NS_ReleaseOnMainThread() if we're going to leak anyway.

Review of attachment 8776728 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.
Attachment #8776728 - Flags: review?(nfroyd) → review+
Pushed by seth.bugzilla@blackhail.net:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4c6dc34d653d
Take the value of |aDoomed| in NS_ReleaseOnMainThread() if we're going to leak anyway. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/4c6dc34d653d
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: