diff --git a/content/xslt/src/base/txCore.h b/content/xslt/src/base/txCore.h index d0700c71841..8953c38bc43 100644 --- a/content/xslt/src/base/txCore.h +++ b/content/xslt/src/base/txCore.h @@ -41,6 +41,7 @@ #include "nscore.h" #include "nsDebug.h" +#include "nsTraceRefcnt.h" #include "prtypes.h" #include "txDouble.h" @@ -49,11 +50,17 @@ class nsAString; class txObject { public: + txObject() + { + MOZ_COUNT_CTOR(txObject); + } + /** * Deletes this txObject */ virtual ~txObject() { + MOZ_COUNT_DTOR(txObject); } }; diff --git a/content/xslt/src/xpath/txExpr.h b/content/xslt/src/xpath/txExpr.h index e42acbf1fc4..ca7ff01ce18 100644 --- a/content/xslt/src/xpath/txExpr.h +++ b/content/xslt/src/xpath/txExpr.h @@ -70,6 +70,15 @@ class txXPathNode; class Expr { public: + Expr() + { + MOZ_COUNT_CTOR(Expr); + } + virtual ~Expr() + { + MOZ_COUNT_DTOR(Expr); + } + /** * Evaluates this Expr based on the given context node and processor state * @param context the context node for evaluation of this Expr @@ -405,7 +414,15 @@ private: class txNodeTest { public: - virtual ~txNodeTest() {} + txNodeTest() + { + MOZ_COUNT_CTOR(txNodeTest); + } + virtual ~txNodeTest() + { + MOZ_COUNT_DTOR(txNodeTest); + } + /* * Virtual methods * pretty much a txPattern, but not supposed to be used diff --git a/content/xslt/src/xpath/txExprResult.h b/content/xslt/src/xpath/txExprResult.h index 055eec45cdc..8442ce66254 100644 --- a/content/xslt/src/xpath/txExprResult.h +++ b/content/xslt/src/xpath/txExprResult.h @@ -72,10 +72,14 @@ public: txAExprResult(txResultRecycler* aRecycler) : mRecycler(aRecycler) { } + virtual ~txAExprResult() + { + } void AddRef() { ++mRefCnt; + NS_LOG_ADDREF(this, mRefCnt, "txAExprResult", sizeof(*this)); } void Release(); // Implemented in txResultRecycler.cpp diff --git a/content/xslt/src/xpath/txResultRecycler.cpp b/content/xslt/src/xpath/txResultRecycler.cpp index f97d28a9f13..77e0e250cf3 100644 --- a/content/xslt/src/xpath/txResultRecycler.cpp +++ b/content/xslt/src/xpath/txResultRecycler.cpp @@ -290,7 +290,9 @@ txResultRecycler::getNonSharedNodeSet(txNodeSet* aNodeSet, txNodeSet** aResult) void txAExprResult::Release() { - if (--mRefCnt == 0) { + --mRefCnt; + NS_LOG_RELEASE(this, mRefCnt, "txAExprResult"); + if (mRefCnt == 0) { if (mRecycler) { mRecycler->recycle(this); } diff --git a/content/xslt/src/xpath/txResultRecycler.h b/content/xslt/src/xpath/txResultRecycler.h index 7d452e5c26e..d463a0f6051 100644 --- a/content/xslt/src/xpath/txResultRecycler.h +++ b/content/xslt/src/xpath/txResultRecycler.h @@ -59,10 +59,13 @@ public: void AddRef() { ++mRefCnt; + NS_LOG_ADDREF(this, mRefCnt, "txResultRecycler", sizeof(*this)); } void Release() { - if (--mRefCnt == 0) { + --mRefCnt; + NS_LOG_RELEASE(this, mRefCnt, "txResultRecycler"); + if (mRefCnt == 0) { mRefCnt = 1; //stabilize delete this; } diff --git a/content/xslt/src/xslt/txInstructions.h b/content/xslt/src/xslt/txInstructions.h index 5d0df20432b..4079217daec 100644 --- a/content/xslt/src/xslt/txInstructions.h +++ b/content/xslt/src/xslt/txInstructions.h @@ -53,18 +53,19 @@ class txExecutionState; class txInstruction : public TxObject { public: - txInstruction() : mNext(0) + txInstruction() { + MOZ_COUNT_CTOR(txInstruction); } virtual ~txInstruction() { - delete mNext; + MOZ_COUNT_DTOR(txInstruction); } virtual nsresult execute(txExecutionState& aEs) = 0; - txInstruction* mNext; + nsAutoPtr mNext; }; #define TX_DECL_TXINSTRUCTION \ diff --git a/content/xslt/src/xslt/txStylesheet.h b/content/xslt/src/xslt/txStylesheet.h index 7f69016f454..d76e1b99747 100644 --- a/content/xslt/src/xslt/txStylesheet.h +++ b/content/xslt/src/xslt/txStylesheet.h @@ -236,6 +236,14 @@ protected: class txIGlobalParameter { public: + txIGlobalParameter() + { + MOZ_COUNT_CTOR(txIGlobalParameter); + } + virtual ~txIGlobalParameter() + { + MOZ_COUNT_DTOR(txIGlobalParameter); + } virtual nsresult getValue(txAExprResult** aValue) = 0; }; diff --git a/content/xslt/src/xslt/txStylesheetCompiler.cpp b/content/xslt/src/xslt/txStylesheetCompiler.cpp index efbd19ace42..aae65120166 100644 --- a/content/xslt/src/xslt/txStylesheetCompiler.cpp +++ b/content/xslt/src/xslt/txStylesheetCompiler.cpp @@ -72,13 +72,17 @@ txStylesheetCompiler::txStylesheetCompiler(const nsAString& aStylesheetURI, nsrefcnt txStylesheetCompiler::AddRef() { - return ++mRefCnt; + ++mRefCnt; + NS_LOG_ADDREF(this, mRefCnt, "txStylesheetCompiler", sizeof(*this)); + return mRefCnt; } nsrefcnt txStylesheetCompiler::Release() { - if (--mRefCnt == 0) { + --mRefCnt; + NS_LOG_RELEASE(this, mRefCnt, "txStylesheetCompiler"); + if (mRefCnt == 0) { mRefCnt = 1; //stabilize delete this; return 0; @@ -764,7 +768,7 @@ txStylesheetCompilerState::addInstruction(nsAutoPtr aInstruction) txInstruction* newInstr = aInstruction; *mNextInstrPtr = aInstruction.forget(); - mNextInstrPtr = &newInstr->mNext; + mNextInstrPtr = newInstr->mNext.StartAssignment(); PRInt32 i, count = mGotoTargetPointers.Count(); for (i = 0; i < count; ++i) { diff --git a/content/xslt/src/xslt/txToplevelItems.h b/content/xslt/src/xslt/txToplevelItems.h index f4876c2d2de..61b2be7e669 100644 --- a/content/xslt/src/xslt/txToplevelItems.h +++ b/content/xslt/src/xslt/txToplevelItems.h @@ -51,8 +51,13 @@ class Expr; class txToplevelItem { public: + txToplevelItem() + { + MOZ_COUNT_CTOR(txToplevelItem); + } virtual ~txToplevelItem() { + MOZ_COUNT_DTOR(txToplevelItem); } enum type {