Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Maybe fix memory leak caused by not disposing Icons and Bitmaps. #262
Icon implements IDisposable and must therefore be disposed.
This commit is untested since I cannot compile the project.
Leaving Icons laying around eventually triggers an ExternalException when calling Bitmap.GetHicon, caused by GDI+ not wanting to give you any more handles. This has happened to a friend, who has asked me to maybe try and fix it.
Since I cannot compile the project (Visual Studio can't find some of the referenced assemblies, like NAudio) I cannot test this fix. Please make sure to test everything before merging.
So in short:
Thanks for this, I see the problem.
I've merged your changes, but with keeping the cache, only a different implementation, an expirable one. If the Icon is not retrieved for 5 minutes, it's disposed and removed from the cache.
This should resolve any issue there were with the icons.