From 8c83072a5170b0e7fd34c2345da20634ecf9504c Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Tue, 23 Jun 2009 12:09:13 +0200 Subject: [PATCH] Fix for bug 499787 (Remove one AddRef/Release pair from GatherProtoScriptableCreateInfo). r/sr=mrbkap. --HG-- extra : rebase_source : 2db51a8d57cf6bdb8c42e677a819e1d3687e3593 --- js/src/xpconnect/src/xpcprivate.h | 5 +++++ js/src/xpconnect/src/xpcwrappednative.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index 5dad1589c53..8d2a34e8b66 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -1811,6 +1811,8 @@ public: void SetCallback(nsIXPCScriptable* s) {mCallback = s;} + void + SetCallback(already_AddRefed s) {mCallback = s;} void SetScriptableShared(XPCNativeScriptableShared* shared) {mShared = shared;} @@ -1859,6 +1861,9 @@ public: void SetCallback(nsIXPCScriptable* callback) {mCallback = callback;} + void + SetCallback(already_AddRefed callback) + {mCallback = callback;} void SetFlags(const XPCNativeScriptableFlags& flags) {mFlags = flags;} diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index 3a352d1428e..82e89084cba 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -807,7 +807,7 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo( if(NS_FAILED(rv)) flags = 0; - sciProto->SetCallback(helper); + sciProto->SetCallback(helper.forget()); sciProto->SetFlags(flags); } } @@ -846,7 +846,7 @@ XPCWrappedNative::GatherScriptableCreateInfo( if(NS_FAILED(rv)) flags = 0; - sciWrapper->SetCallback(helper); + sciWrapper->SetCallback(helper.forget()); sciWrapper->SetFlags(flags); // A whole series of assertions to catch bad uses of scriptable flags on