Closed Bug 1207368 Opened 9 years ago Closed 9 years ago

Intermittent test_bug429954.xul | application crashed [@ nsScriptErrorWithStack::AddRef()]

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: KWierso, Assigned: mccr8)

References

(Blocks 1 open bug)

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

Assignee: nobody → continuation
Blocks: 1210747
Component: Widget → XPCOM
See bug 1210747 for an explanation.
Using forget() to extract mMessage from MessageElement ends up going
from nsCOMPtr<T> to already_AddRefed<T> to nsCOMPtr<T>. For the second
step, the compiler can't tell that the already_AddRefed<T> came from a
canonical nsCOMPtr, so it calls Assert_NoQueryNeeded() in debug
builds. This in turn causes a QI, which does an AddRef. That is bad
because we're not on the main thread, and mMessage is
main-thread-only, so we get an assertion.

This patch works around that by using swap directly between two
nsCOMPtr<>, which avoids the Assert_NoQueryNeeded().

I called the method "swapMessage" rather than "swap" to emphasize that
we are not swapping the whole MessageElement, but just one part of
it. I find the existing forget() name to be confusing.

try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c3ae9760c82c
Attachment #8669153 - Flags: review?(nfroyd)
Attachment #8669153 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/5845fb9f14cf
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: