We need to be careful using the ViewTreeObserver getter. It can return different instances depending on where the view is in its lifecycle, resulting in events being unsubscribed from instances they were not subscribed to.
This PR converts the event subscription to using an explicit handler, which allows us to subscribe to the event using a weak reference back to the renderer and thus avoiding the memory leak.
Fixes #110
We need to be careful using the ViewTreeObserver getter. It can return different instances depending on where the view is in its lifecycle, resulting in events being unsubscribed from instances they were not subscribed to.
This PR converts the event subscription to using an explicit handler, which allows us to subscribe to the event using a weak reference back to the renderer and thus avoiding the memory leak.