When a Node is deleted, AXObjectCache has to be notified so it doesn't have any stale references to that object. However, doing that in the Node destructor is problematic - in particular, it needs some hacks so that it can be called at different times in ContainerNode's destructor vs Node's destructor. Instead, this should be called in another method of Node that always gets called before the destructor. Let's add an assertion in debug mode that ensures this method always got called.
See also: bug 106106. If the current patch in that bug gets landed, it will need to be reverted here, too.
Hmmm, unfortunately it looks like Node::removedFrom is called *after* a node has been removed from the tree...is there any method we can hook into that will be called before a node is removed, so that the accessibility code can walk the parent chain and handle live region updates?
How about Document::nodeWillBeRemoved()?
<rdar://problem/16013958>