From kfm-devel Fri Jun 03 12:47:10 2005 From: Andrew Coles Date: Fri, 03 Jun 2005 12:47:10 +0000 To: kfm-devel Subject: Re: onload event listeners attached to NodeImpls which fail to be Message-Id: <200506031347.10376.andrew_coles () yahoo ! co ! uk> X-MARC-Message: https://marc.info/?l=kfm-devel&m=111780307904690 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