зеркало из https://github.com/mozilla/gecko-dev.git
e2ebefc242
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. |
||
---|---|---|
.. | ||
base | ||
build | ||
components | ||
doc | ||
ds | ||
glue | ||
idl-parser | ||
io | ||
libxpcomrt | ||
libxpt/xptcall | ||
reflect | ||
string | ||
system | ||
tests | ||
threads | ||
typelib | ||
windbgdlg | ||
xpidl | ||
Makefile.in | ||
moz.build | ||
xpcom-config.h.in | ||
xpcom-private.h.in |