mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 961551, part 2 - Move addref out of XPCWrappedJS ctor. r=bholley
This paves the way for smart pointerization.
This commit is contained in:
parent
dd44ea589f
commit
1042fc8b9b
@ -362,6 +362,7 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj,
|
||||
if (rootJSObj == jsObj) {
|
||||
// the root will do double duty as the interface wrapper
|
||||
wrapper = new nsXPCWrappedJS(cx, jsObj, clasp, nullptr);
|
||||
NS_ADDREF(wrapper);
|
||||
*wrapperResult = wrapper;
|
||||
return NS_OK;
|
||||
} else {
|
||||
@ -373,6 +374,7 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
root = new nsXPCWrappedJS(cx, rootJSObj, rootClasp, nullptr);
|
||||
NS_ADDREF(root);
|
||||
NS_RELEASE(rootClasp);
|
||||
|
||||
release_root = true;
|
||||
@ -385,6 +387,7 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj,
|
||||
MOZ_ASSERT(!wrapper, "no wrapper found yet");
|
||||
|
||||
wrapper = new nsXPCWrappedJS(cx, jsObj, clasp, root);
|
||||
NS_ADDREF(wrapper);
|
||||
|
||||
if (release_root)
|
||||
NS_RELEASE(root);
|
||||
@ -408,7 +411,6 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSContext* cx,
|
||||
// that are subject to finalization. See the top of the file for more
|
||||
// details.
|
||||
NS_ADDREF_THIS();
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
if (IsRootWrapper()) {
|
||||
nsXPConnect::GetRuntimeInstance()->GetWrappedJSMap()->Add(cx, this);
|
||||
|
Loading…
Reference in New Issue
Block a user