[Webkit-unassigned] [Bug 8850] cocoa bindings - crash when DOM nodes are deleted while NSTreeController+NSTableView are bound

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Wed Jun 28 00:11:26 PDT 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=8850





------- Comment #11 from speth at end.com  2006-06-28 00:11 PDT -------
Thanks Darin.  I agree that the notification handling was the weakest part of
this, but I didn't realize the performance impact was so large.  I have an idea
about how to do this differently I want to run past you before coding it.  The
basic idea is to flip things around and have the DOMNode request notifications
if it's being observed.  Everything would be set up when the observer is added,
and torn down when the observer is removed, so there is very little work that
needs to take place when the change actually occurs.  Here's how it would go:

1.  DOMNode overrides the KVO add/remove methods, calling super for each, but
watching for observers of childNodes, and keeping a count of them.

2.  When childNodes gets a new observer, the DOMNode calls down into Node
(setChildNodesModifiedCallback or something) and passes it a function pointer
and a void * context.  These are stored as properties of the Node.  DOMNode
increments the observer count.

3.  In Node::childrenChanged, if the function pointer is non-null, call it with
the context.

4.  The callback function could then simply map the context back to the DOMNode
(possibly just by casting it), and issue the KVO notifications for the
DOMNode's childNodes.

5.  When a childNode observer is removed, decrement the count.  If count goes
to zero, the function pointer is cleared.

Does that sound better?


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list