Skip to content

Commit

Permalink
Merge pull request #5211 from bclothier/PlugWPFLeak
Browse files Browse the repository at this point in the history
Plug the WPF leak... maybe.
  • Loading branch information
retailcoder committed Oct 13, 2019
2 parents 37c252e + 6bef5f6 commit 06b1501
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Rubberduck.Core/UI/Converters/ImageSourceConverter.cs
Expand Up @@ -12,17 +12,19 @@ public abstract class ImageSourceConverter : IValueConverter
{
protected static ImageSource ToImageSource(Image source)
{
var ms = new MemoryStream();
using (var ms = new MemoryStream())
{
((Bitmap) source).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
var image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
ms.Seek(0, SeekOrigin.Begin);
image.StreamSource = ms;
image.EndInit();
image.Freeze();

((Bitmap)source).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
var image = new BitmapImage();
image.BeginInit();
ms.Seek(0, SeekOrigin.Begin);
image.StreamSource = ms;
image.EndInit();
image.Freeze();

return image;
return image;
}
}

public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);
Expand Down

0 comments on commit 06b1501

Please sign in to comment.