mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 501577 - Add a missing call to Release in nsXPCWrappedJS::GetNewOrUsed. Also remove a hack needed to get around the missing release. r+sr=peterv
This commit is contained in:
parent
e924b93855
commit
3a7c25ffc5
@ -307,6 +307,7 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
nsXPCWrappedJS* wrapper = nsnull;
|
nsXPCWrappedJS* wrapper = nsnull;
|
||||||
nsXPCWrappedJSClass* clazz = nsnull;
|
nsXPCWrappedJSClass* clazz = nsnull;
|
||||||
XPCJSRuntime* rt = ccx.GetRuntime();
|
XPCJSRuntime* rt = ccx.GetRuntime();
|
||||||
|
JSBool release_root = JS_FALSE;
|
||||||
|
|
||||||
map = rt->GetWrappedJSMap();
|
map = rt->GetWrappedJSMap();
|
||||||
if(!map)
|
if(!map)
|
||||||
@ -341,6 +342,7 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!root)
|
if(!root)
|
||||||
{
|
{
|
||||||
// build the root wrapper
|
// build the root wrapper
|
||||||
@ -374,6 +376,9 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
|
|
||||||
if(!root)
|
if(!root)
|
||||||
goto return_wrapper;
|
goto return_wrapper;
|
||||||
|
|
||||||
|
release_root = JS_TRUE;
|
||||||
|
|
||||||
{ // scoped lock
|
{ // scoped lock
|
||||||
#if DEBUG_xpc_leaks
|
#if DEBUG_xpc_leaks
|
||||||
printf("Created nsXPCWrappedJS %p, JSObject is %p\n",
|
printf("Created nsXPCWrappedJS %p, JSObject is %p\n",
|
||||||
@ -407,6 +412,9 @@ return_wrapper:
|
|||||||
if(clazz)
|
if(clazz)
|
||||||
NS_RELEASE(clazz);
|
NS_RELEASE(clazz);
|
||||||
|
|
||||||
|
if(release_root)
|
||||||
|
NS_RELEASE(root);
|
||||||
|
|
||||||
if(!wrapper)
|
if(!wrapper)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user