michael-reichenauer / GitMind

Windows UI Git client
MIT License
28 stars 3 forks source link

Memory leak in RelayCommand? #4

Closed FantasticFiasco closed 8 years ago

FantasticFiasco commented 8 years ago

I've been away from WPF for quite some time, but in previous versions of .NET there was a memory leak if you declared your CanExecuteChanged as you do in the class RelayCommand.

What one could do was to use a weak event (as you say in the note), but the easiest way was to pass on the handler to the CommandManager.

If you choose to go with the CommandManager, that is an easy fix and I can have a PR for you this evening.

michael-reichenauer commented 8 years ago

The CommandManager approach sounds like good idea and any hint on this would be appreciated. I will soon change RelayCommand to an async approach, but the underlying functionality would be the same so the memory leak needs to be addressed.

FantasticFiasco commented 8 years ago

It seems like my WPF knowledge is a bit outdated. I looked at both MVVM Light and Prism, and they no longer are defensive against the memory leak. That makes me believe that it no longer is a problem.