[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: onload event listeners attached to NodeImpls which fail to be
From:       Andrew Coles <andrew_coles () yahoo ! co ! uk>
Date:       2005-05-27 12:04:23
Message-ID: 200505271304.23809.andrew_coles () yahoo ! co ! uk
[Download RAW message or body]

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;
     }
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic