зеркало из https://github.com/mozilla/pjs.git
Bug 411531 - Assertion failure !rt->gcRunning because I accidentally turned off deffered-release of wrapped natives during GC, r+sr=peterv
This commit is contained in:
Родитель
6598d223ec
Коммит
0e9dffce91
|
@ -794,33 +794,30 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
|
|||
// events above.
|
||||
|
||||
// Do any deferred released of native objects.
|
||||
if(self->GetDeferReleases())
|
||||
nsVoidArray* array = &self->mNativesToReleaseArray;
|
||||
#ifdef XPC_TRACK_DEFERRED_RELEASES
|
||||
printf("XPC - Begin deferred Release of %d nsISupports pointers\n",
|
||||
array->Count());
|
||||
#endif
|
||||
while(1)
|
||||
{
|
||||
nsVoidArray* array = &self->mNativesToReleaseArray;
|
||||
#ifdef XPC_TRACK_DEFERRED_RELEASES
|
||||
printf("XPC - Begin deferred Release of %d nsISupports pointers\n",
|
||||
array->Count());
|
||||
#endif
|
||||
while(1)
|
||||
nsISupports* obj;
|
||||
{
|
||||
nsISupports* obj;
|
||||
PRInt32 count = array->Count();
|
||||
if(!count)
|
||||
{
|
||||
PRInt32 count = array->Count();
|
||||
if(!count)
|
||||
{
|
||||
array->Compact();
|
||||
break;
|
||||
}
|
||||
obj = reinterpret_cast<nsISupports*>
|
||||
(array->ElementAt(count-1));
|
||||
array->RemoveElementAt(count-1);
|
||||
array->Compact();
|
||||
break;
|
||||
}
|
||||
NS_RELEASE(obj);
|
||||
obj = reinterpret_cast<nsISupports*>
|
||||
(array->ElementAt(count-1));
|
||||
array->RemoveElementAt(count-1);
|
||||
}
|
||||
#ifdef XPC_TRACK_DEFERRED_RELEASES
|
||||
printf("XPC - End deferred Releases\n");
|
||||
#endif
|
||||
NS_RELEASE(obj);
|
||||
}
|
||||
#ifdef XPC_TRACK_DEFERRED_RELEASES
|
||||
printf("XPC - End deferred Releases\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -1055,7 +1052,6 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect,
|
|||
mThreadRunningGC(nsnull),
|
||||
mWrappedJSToReleaseArray(),
|
||||
mNativesToReleaseArray(),
|
||||
mDeferReleases(JS_FALSE),
|
||||
mDoingFinalization(JS_FALSE),
|
||||
mVariantRoots(nsnull),
|
||||
mWrappedJSRoots(nsnull),
|
||||
|
@ -1258,7 +1254,6 @@ JSBool
|
|||
XPCJSRuntime::DeferredRelease(nsISupports* obj)
|
||||
{
|
||||
NS_ASSERTION(obj, "bad param");
|
||||
NS_ASSERTION(GetDeferReleases(), "bad call");
|
||||
|
||||
if(!mNativesToReleaseArray.Count())
|
||||
{
|
||||
|
|
|
@ -656,13 +656,6 @@ public:
|
|||
XPCContext* GetXPCContext(JSContext* cx);
|
||||
XPCContext* SyncXPCContextList(JSContext* cx = nsnull);
|
||||
|
||||
JSBool GetDeferReleases() const {return mDeferReleases;}
|
||||
void SetDeferReleases(JSBool b)
|
||||
{/* If deferring is turned off while any are pending they'll leak! */
|
||||
NS_ASSERTION((mDeferReleases && b) ||
|
||||
!mNativesToReleaseArray.Count(), "bad");
|
||||
mDeferReleases = b;}
|
||||
|
||||
JSBool DeferredRelease(nsISupports* obj);
|
||||
|
||||
JSBool GetDoingFinalization() const {return mDoingFinalization;}
|
||||
|
@ -787,7 +780,6 @@ private:
|
|||
PRThread* mThreadRunningGC;
|
||||
nsVoidArray mWrappedJSToReleaseArray;
|
||||
nsVoidArray mNativesToReleaseArray;
|
||||
JSBool mDeferReleases;
|
||||
JSBool mDoingFinalization;
|
||||
XPCRootSetElem *mVariantRoots;
|
||||
XPCRootSetElem *mWrappedJSRoots;
|
||||
|
|
|
@ -664,7 +664,7 @@ XPCWrappedNative::~XPCWrappedNative()
|
|||
if(mIdentity)
|
||||
{
|
||||
XPCJSRuntime* rt = GetRuntime();
|
||||
if(rt && rt->GetDeferReleases() && rt->GetDoingFinalization())
|
||||
if(rt && rt->GetDoingFinalization())
|
||||
{
|
||||
if(!rt->DeferredRelease(mIdentity))
|
||||
{
|
||||
|
@ -1005,7 +1005,7 @@ XPCWrappedNative::FlatJSObjectFinalized(JSContext *cx)
|
|||
NS_ASSERTION(*(int*)obj != 0, "bad pointer!");
|
||||
#endif
|
||||
XPCJSRuntime* rt = GetRuntime();
|
||||
if(rt && rt->GetDeferReleases())
|
||||
if(rt)
|
||||
{
|
||||
if(!rt->DeferredRelease(obj))
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче