Bug 947336, part 2 - Make nsXPCWrappedJS::mClass a smart pointer. r=bholley

This commit is contained in:
Andrew McCreight 2014-01-02 11:33:41 -08:00
parent d9c65a6e80
commit 1d5a828eca
2 changed files with 3 additions and 5 deletions

View File

@ -434,8 +434,6 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSContext* cx,
NS_ADDREF_THIS();
NS_ADDREF_THIS();
NS_ADDREF(aClass);
if (!IsRootWrapper())
NS_ADDREF(mRoot);
@ -496,7 +494,7 @@ nsXPCWrappedJS::Unlink()
NS_RELEASE(mRoot);
}
NS_IF_RELEASE(mClass);
mClass = nullptr;
if (mOuter) {
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
if (rt->GCIsRunning()) {
@ -647,7 +645,7 @@ nsXPCWrappedJS::DebugDump(int16_t depth)
XPC_LOG_ALWAYS(("IID number is %s", iid ? iid : "invalid"));
if (iid)
NS_Free(iid);
XPC_LOG_ALWAYS(("nsXPCWrappedJSClass @ %x", mClass));
XPC_LOG_ALWAYS(("nsXPCWrappedJSClass @ %x", mClass.get()));
if (!IsRootWrapper())
XPC_LOG_OUTDENT();

View File

@ -2535,7 +2535,7 @@ protected:
private:
JS::Heap<JSObject*> mJSObj;
nsXPCWrappedJSClass* mClass;
nsRefPtr<nsXPCWrappedJSClass> mClass;
nsXPCWrappedJS* mRoot;
nsXPCWrappedJS* mNext;
nsCOMPtr<nsISupports> mOuter; // only set in root