onload event listeners attached to NodeImpls which fail to be attached

Andrew Coles andrew_coles at yahoo.co.uk
Fri May 27 13:04:23 BST 2005


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<ElementImpl *>(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;
     }
 }




More information about the kfm-devel mailing list