robrix/Haxcessibility — pull request #25 by numist (2014-01-15 17:54:58+00:00)
Title: Lazy notification registration and a deregistration bugfix.

* IPC is expensive, so only register for notifications when necessary.
* This has not been a problem yet, but for Future Us `addAXObserver` will early return if the element has already registered an observer.
* Remove the observer before the element. The bug was as follows:
* `HAXElement dealloc`
* Release `elementRef`
* Deregister `observer`, which fails because `elementRef` is gone
* Receive notification with an invalid object pointer for `refcon` (After `self` finished `dealloc`)
* Crash