From 5e0ce1470ab2f5b125bbcdce6cf60fa4d620921d Mon Sep 17 00:00:00 2001 From: "sicking%bigfoot.com" Date: Tue, 18 Mar 2003 14:33:00 +0000 Subject: [PATCH] nsAutoPtr love, hopefully builds on mac now. The handlers should never leak now. Also fix a bug in the with-param handler. git-svn-id: svn://10.0.0.236/branches/TX_COMPILE_BRANCH@139670 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/transformiix/source/xpath/Expr.h | 10 +++------- .../transformiix/source/xpath/ExprParser.cpp | 3 +-- .../transformiix/source/xpath/LocationStep.cpp | 11 +---------- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/mozilla/extensions/transformiix/source/xpath/Expr.h b/mozilla/extensions/transformiix/source/xpath/Expr.h index f816a5d8945..81a42d00df6 100644 --- a/mozilla/extensions/transformiix/source/xpath/Expr.h +++ b/mozilla/extensions/transformiix/source/xpath/Expr.h @@ -41,6 +41,7 @@ #include "nsString.h" #include "nsIAtom.h" #include "TxObject.h" +#include "nsAutoPtr.h" /* XPath class definitions. @@ -343,18 +344,13 @@ public: * @param nodeExpr the NodeExpr to use when matching Nodes * @param axisIdentifier the Axis Identifier in which to search for nodes **/ - LocationStep(txNodeTest* aNodeTest, LocationStepType aAxisIdentifier); - - /** - * Destructor, will delete all predicates and the given NodeExpr - **/ - virtual ~LocationStep(); + LocationStep(nsAutoPtr aNodeTest, LocationStepType aAxisIdentifier); TX_DECL_EXPR; private: - txNodeTest* mNodeTest; + nsAutoPtr mNodeTest; LocationStepType mAxisIdentifier; void fromDescendants(Node* node, txIMatchContext* aContext, diff --git a/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp b/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp index c6740e36761..981665f3f98 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp @@ -537,7 +537,7 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer, { //-- child axis is default LocationStep::LocationStepType axisIdentifier = LocationStep::CHILD_AXIS; - txNodeTest* nodeTest = 0; + nsAutoPtr nodeTest; //-- get Axis Identifier or AbbreviatedStep, if present Token* tok = lexer.peek(); @@ -677,7 +677,6 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer, LocationStep* lstep = new LocationStep(nodeTest, axisIdentifier); if (!lstep) { //XXX out of memory - delete nodeTest; return 0; } diff --git a/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp b/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp index 3d88510b25b..dc40f3cfe05 100644 --- a/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp +++ b/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp @@ -36,21 +36,12 @@ * @param nodeExpr the NodeExpr to use when matching Nodes * @param axisIdentifier the Axis Identifier in which to search for nodes **/ -LocationStep::LocationStep(txNodeTest* aNodeTest, +LocationStep::LocationStep(nsAutoPtr aNodeTest, LocationStepType aAxisIdentifier) : mNodeTest(aNodeTest), mAxisIdentifier(aAxisIdentifier) { } //-- LocationStep -/** - * Destroys this LocationStep - * All predicates will be deleted - * The NodeExpr will be deleted -**/ -LocationStep::~LocationStep() { - delete mNodeTest; -} //-- ~LocationStep - //-----------------------------/ //- Virtual methods from Expr -/ //-----------------------------/