When stabilized during destruction, report AddRef to 2 and Release to 1, to avoid confusing nsTraceRefcnt logging (part 2). b=370702 r=graydon sr=peterv

This commit is contained in:
dbaron%dbaron.org 2007-03-05 21:11:21 +00:00
Родитель 8955dfa9d5
Коммит a560bbe453
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -345,9 +345,9 @@ NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
{ \
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
NS_ASSERT_OWNINGTHREAD(_class); \
mRefCnt.incr(NS_STATIC_CAST(_basetype *, this)); \
NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \
return mRefCnt; \
nsrefcnt count = mRefCnt.incr(NS_STATIC_CAST(_basetype *, this)); \
NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \
return count; \
}
#define NS_IMPL_CYCLE_COLLECTING_ADDREF(_class) \
@ -358,14 +358,14 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
{ \
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
NS_ASSERT_OWNINGTHREAD(_class); \
mRefCnt.decr(NS_STATIC_CAST(_basetype *, this)); \
NS_LOG_RELEASE(this, mRefCnt, #_class); \
if (mRefCnt == 0) { \
nsrefcnt count = mRefCnt.decr(NS_STATIC_CAST(_basetype *, this)); \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
mRefCnt.stabilizeForDeletion(NS_STATIC_CAST(_basetype *, this)); \
_destroy; \
return 0; \
} \
return mRefCnt; \
return count; \
}
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(_class, _destroy) \