Skip to content
Snippets Groups Projects
Commit 229409f5 authored by jband%netscape.com's avatar jband%netscape.com
Browse files

fix bug 100260. xpconnect should not hold a weak reference to a classinfo...

fix bug 100260. xpconnect should not hold a weak reference to a classinfo object after the xpcwrappednativeproto that was holding a strong ref is destroyed. sr=jst, r=dbradley,markh.
parent 06006e41
No related branches found
No related tags found
No related merge requests found
......@@ -1197,6 +1197,8 @@ public:
XPCNativeInterface* newInterface,
PRUint16 position);
static void ClearCacheEntryForClassInfo(nsIClassInfo* classInfo);
inline JSBool FindMember(jsval name, XPCNativeMember** pMember,
PRUint16* pInterfaceIndex) const;
......
......@@ -666,6 +666,21 @@ out:
return set;
}
// static
void
XPCNativeSet::ClearCacheEntryForClassInfo(nsIClassInfo* classInfo)
{
XPCJSRuntime* rt;
ClassInfo2NativeSetMap* map;
if(nsnull != (rt = nsXPConnect::GetRuntime()) &&
nsnull != (map = rt->GetClassInfo2NativeSetMap()))
{ // scoped lock
XPCAutoLock lock(rt->GetMapLock());
map->Remove(classInfo);
}
}
// static
XPCNativeSet*
XPCNativeSet::GetNewOrUsed(XPCCallContext& ccx,
......
......@@ -74,6 +74,10 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto()
#ifdef DEBUG
PR_AtomicDecrement(&gDEBUG_LiveProtoCount);
#endif
// Note that our weak ref to mScope is not to be trusted at this point.
XPCNativeSet::ClearCacheEntryForClassInfo(mClassInfo);
delete mScriptableInfo;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment