Browse Source

#2299: Make sure all images are frozen.

pull/2357/head
Siegfried Pammer 4 years ago
parent
commit
6169e678b2
  1. 25
      ILSpy/Images/Images.cs
  2. 2
      ILSpy/MainWindow.xaml.cs

25
ILSpy/Images/Images.cs

@ -29,7 +29,13 @@ namespace ICSharpCode.ILSpy @@ -29,7 +29,13 @@ namespace ICSharpCode.ILSpy
{
static ImageSource Load(string icon)
{
return new DrawingImage(LoadDrawingGroup(null, "Images/" + icon));
var image = new DrawingImage(LoadDrawingGroup(null, "Images/" + icon));
if (image.CanFreeze)
{
image.Freeze();
}
return image;
}
public static readonly ImageSource ILSpyIcon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
@ -103,7 +109,12 @@ namespace ICSharpCode.ILSpy @@ -103,7 +109,12 @@ namespace ICSharpCode.ILSpy
Uri uri = GetUri(part, icon + ".xaml");
if (ResourceExists(uri))
{
return new DrawingImage(LoadDrawingGroup(part, icon));
var image = new DrawingImage(LoadDrawingGroup(part, icon));
if (image.CanFreeze)
{
image.Freeze();
}
return image;
}
return LoadImage(part, icon + ".png");
}
@ -112,7 +123,10 @@ namespace ICSharpCode.ILSpy @@ -112,7 +123,10 @@ namespace ICSharpCode.ILSpy
{
Uri uri = GetUri(part, icon);
BitmapImage image = new BitmapImage(uri);
image.Freeze();
if (image.CanFreeze)
{
image.Freeze();
}
return image;
}
@ -383,7 +397,10 @@ namespace ICSharpCode.ILSpy @@ -383,7 +397,10 @@ namespace ICSharpCode.ILSpy
}
var image = new DrawingImage(group);
image.Freeze();
if (image.CanFreeze)
{
image.Freeze();
}
return image;
}
}

2
ILSpy/MainWindow.xaml.cs

@ -112,7 +112,7 @@ namespace ICSharpCode.ILSpy @@ -112,7 +112,7 @@ namespace ICSharpCode.ILSpy
this.AssemblyListManager = new AssemblyListManager(spySettings);
// Make sure Images are initialized on the UI thread.
//this.Icon = Images.ILSpyIcon;
this.Icon = Images.ILSpyIcon;
this.DataContext = new MainWindowDataContext {
Workspace = DockWorkspace.Instance,

Loading…
Cancel
Save