зеркало из https://github.com/mozilla/gecko-dev.git
add deathgrip to JSContext to prevent its untimely destruction. fixes bug 20193. r:brendan@mozilla.org
This commit is contained in:
Родитель
2f6776efa2
Коммит
1b74898ee7
|
@ -531,6 +531,12 @@ nsJSContext::CallFunctionObject(void *aObj, void *aFunObj, PRUint32 argc,
|
||||||
if (NS_FAILED(rv) || NS_FAILED(stack->Push(mContext)))
|
if (NS_FAILED(rv) || NS_FAILED(stack->Push(mContext)))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
// this context can be deleted unexpectedly if the JS closes
|
||||||
|
// the owning window. we ran into this problem specifically
|
||||||
|
// when going through the "close window" key event handler
|
||||||
|
// (that is, hitting ^W on Windows). the addref just below
|
||||||
|
// prevents our untimely destruction.
|
||||||
|
nsCOMPtr<nsJSContext> kungFuDeathGrip(this);
|
||||||
mRef = nsnull;
|
mRef = nsnull;
|
||||||
mTerminationFunc = nsnull;
|
mTerminationFunc = nsnull;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче