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
This commit is contained in:
sicking%bigfoot.com
2003-03-18 14:33:00 +00:00
parent 2432eba32a
commit 5e0ce1470a
3 changed files with 5 additions and 19 deletions

View File

@@ -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<txNodeTest> aNodeTest, LocationStepType aAxisIdentifier);
TX_DECL_EXPR;
private:
txNodeTest* mNodeTest;
nsAutoPtr<txNodeTest> mNodeTest;
LocationStepType mAxisIdentifier;
void fromDescendants(Node* node, txIMatchContext* aContext,

View File

@@ -537,7 +537,7 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer,
{
//-- child axis is default
LocationStep::LocationStepType axisIdentifier = LocationStep::CHILD_AXIS;
txNodeTest* nodeTest = 0;
nsAutoPtr<txNodeTest> 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;
}

View File

@@ -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<txNodeTest> 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 -/
//-----------------------------/