From kfm-devel Fri May 27 12:04:23 2005 From: Andrew Coles Date: Fri, 27 May 2005 12:04:23 +0000 To: kfm-devel Subject: Re: onload event listeners attached to NodeImpls which fail to be Message-Id: <200505271304.23809.andrew_coles () yahoo ! co ! uk> X-MARC-Message: https://marc.info/?l=kfm-devel&m=111719550214625 OK, in Webcore the line to delete a NodeImpl if it hasn't been attached to something has been removed, and the attribute map is cleared instead. Would not deleting the nodeimpl create a memory leak? The diff is below. Andrew Index: html/htmlparser.cpp =================================================================== --- html/htmlparser.cpp (revision 418687) +++ html/htmlparser.cpp (working copy) @@ -279,6 +279,13 @@ if ( !insertNode(n, t->flat) ) { // we couldn't insert the node... + + if(n->isElementNode() && t->tid != ID_ISINDEX) + { + ElementImpl *e = static_cast(n); + e->setAttributeMap(0); + } + #ifdef PARSER_DEBUG kdDebug( 6035 ) << "insertNode failed current=" << current->id() << ", new=" << n->id() << "!" << endl; #endif @@ -296,7 +303,6 @@ #endif form = 0; } - delete n; } }