MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

ComboBoxPopup can cause memory leak

Open spdjudd opened this issue 9 years ago • 3 comments

Hi James,

Firstly, thanks very much for MDXT (and Dragablz) - they're great projects and much appreciated.

The issue I'm seeing is that using a ComboBox causes a memory leak, as the ComboBoxPopup constructor calls AddValueChanged() on a dependency property and never calls RemoveValueChanged(). In my case this prevents views and datatemplates that have comboboxes being collected.

I've posted a test repo here: https://github.com/spdjudd/MdxtComboBoxLeak along with instructions - the app is trivial but to see the leak and the GC roots needs a few windbag steps.

I've also forked and made a change to ComboBoxPopup.cs that fixes the issue here: https://github.com/spdjudd/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/ComboBoxPopup.cs

Happy to submit a pull request if you'd like,

Simon.

spdjudd avatar Feb 15 '17 15:02 spdjudd

Hi,

Yes, please submit a PR and I will review.

James

ButchersBoy avatar Feb 15 '17 16:02 ButchersBoy

https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/pull/624 submitted

spdjudd avatar Feb 16 '17 08:02 spdjudd

Still causes a memory leak. image image image

hinduCoder avatar Dec 04 '18 16:12 hinduCoder