bluelinelabs / Conductor

A small, yet full-featured framework that allows building View-based Android applications
Apache License 2.0
3.89k stars 342 forks source link

Update ancestor change listeners to prevent memory leak #680

Closed EricKuck closed 1 year ago

EricKuck commented 1 year ago

OwnViewTreeLifecycleAndRegistry adds listeners for each of its owning controller's ancestors. The links between controllers may be broken by the time the callbacks happen, meaning it will be unable to remove those listeners. This results in a memory leak. In order to prevent associations like this, this PR adds the concept of a global static listener that all controllers can subscribe to in order to be made aware of changes in the controllers they're interested in.