mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
add deathgrip to JSContext to prevent its untimely destruction. fixes bug 20193. r:brendan@mozilla.org
This commit is contained in:
parent
2f6776efa2
commit
1b74898ee7
@ -531,6 +531,12 @@ nsJSContext::CallFunctionObject(void *aObj, void *aFunObj, PRUint32 argc,
|
||||
if (NS_FAILED(rv) || NS_FAILED(stack->Push(mContext)))
|
||||
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;
|
||||
mTerminationFunc = nsnull;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user