Re:Reference count, don't garbage collect
by Thiez on Saturday July 30, 2022 @01:56AM
(#32284616)
One far-fetched yet simple example would be an observer/observable pair, where the observable mutates observed properties inside its finalizer. The observable will usually contain a reference to the observer, but not the other way round. So when the observable is dead but the observer (optionally) still alive, when the observables finalizer runs it will send a message to the observer.
When our observer is also dead (so the pair is out of scope) it will be a dead object receiving events.
When our observer is also dead (so the pair is out of scope) it will be a dead object receiving events.