onload event listeners attached to NodeImpls which fail to be attached

Andrew Coles andrew_coles at yahoo.co.uk
Fri Jun 3 13:47:10 BST 2005


On Friday 27 May 2005 13:04, Andrew Coles wrote:
> 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.

I've done a little testing with valgrind: not deleting the nodeimpl to which 
the event is attached _does_ create a memory leak; does webcore have some way 
of dealing with this or does it leak?

Personally I think memory leaking to avoid this crash is an inelegant way of 
dealing with the problem.  From what I can see, the presence of event 
listeners does not affect whether the nodeimpl can be attached anywhere. So, 
one approach would be to split parseAttribute up into two parts: 
parseEventAttribute to set event handlers, and parseNonEventAttribute one to 
deal with everything else.  Initially, only call parseNonEventAttribute; 
should the node then be successfully attached, call parseEventAttribute to 
register listeners and so on.

Andrew




More information about the kfm-devel mailing list