Skip to content

Commit

Permalink
Revert "Plug the WPF leak... maybe."
Browse files Browse the repository at this point in the history
  • Loading branch information
bclothier committed Oct 13, 2019
1 parent 6129710 commit 747b1c8
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions Rubberduck.Core/UI/Converters/ImageSourceConverter.cs
Expand Up @@ -12,19 +12,17 @@ public abstract class ImageSourceConverter : IValueConverter
{
protected static ImageSource ToImageSource(Image source)
{
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();
var ms = new MemoryStream();

return image;
}
((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;
}

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

0 comments on commit 747b1c8

Please sign in to comment.