mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 03:18:41 +00:00
Bug 945585 - Add shouldDelete to nsDocument::Release. r=mccr8
This commit is contained in:
parent
2207180e99
commit
35f59dc30c
@ -1639,7 +1639,8 @@ nsDocument::Release()
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||
NS_ASSERT_OWNINGTHREAD(nsDocument);
|
||||
nsISupports* base = NS_CYCLE_COLLECTION_CLASSNAME(nsDocument)::Upcast(this);
|
||||
nsrefcnt count = mRefCnt.decr(base);
|
||||
bool shouldDelete = false;
|
||||
nsrefcnt count = mRefCnt.decr(base, &shouldDelete);
|
||||
NS_LOG_RELEASE(this, count, "nsDocument");
|
||||
if (count == 0) {
|
||||
if (mStackRefCnt && !mNeedsReleaseAfterStackRefCntRelease) {
|
||||
@ -1647,8 +1648,13 @@ nsDocument::Release()
|
||||
NS_ADDREF_THIS();
|
||||
return mRefCnt.get();
|
||||
}
|
||||
NS_ASSERT_OWNINGTHREAD(nsDocument);
|
||||
mRefCnt.incr();
|
||||
nsNodeUtils::LastRelease(this);
|
||||
mRefCnt.decr(base);
|
||||
if (shouldDelete) {
|
||||
mRefCnt.stabilizeForDeletion();
|
||||
DeleteCycleCollectable();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user