reactiveui/ReactiveUI — pull request #689 by jlaanstra (2014-07-31 12:53:14+00:00)
Title: Fix memory leaks in activation.

This PR fixes two memory leaks that cause views to stick around forever. This also fixes #684.

## Memory Leak No. 1:

The `ActivationForViewFetcher` for Xaml wants to be notified of changes to the `IsHitTestVisible` property and subscribes to it, but this subscription sticks around, even if the view is unloaded. Because `IsHitTestVisible` is a dependency property, this leaks the view.

This has been fixed by only listening to `IsHitTestVisible` when the view is loaded.

## Memory Leak No. 2:

The activation logic subscribes to the `ViewModel` property of a view to be notified of changes. Similar to leak no. 1, this subscription sticks around, even if a view is unloaded.

This has been fixed by disposing this subscription when the view is unloaded.

## Long-term Improvement

These fixes made the already complicated activation logic a little more complicated. I believe it has been discussed before why the activation logic consists of two observables, instead of one and I cannot remember what the reasons for having two were. Now might be a good time to refactor this into a single observable returning a bool indicating active or inactive.

Thoughts?