Skip to content

Commit fd59088

Browse files
committed
made data images freeze as well
1 parent 05bd32f commit fd59088

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Wox.Infrastructure/Image/ImageLoader.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ private static ImageResult LoadInternal(string path, bool loadFullImage = false)
100100

101101
if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
102102
{
103-
return new ImageResult(new BitmapImage(new Uri(path)), ImageType.Data);
103+
var imageSource = new BitmapImage(new Uri(path));
104+
imageSource.Freeze();
105+
return new ImageResult(imageSource, ImageType.Data);
104106
}
105107

106108
if (!Path.IsPathRooted(path))
@@ -181,7 +183,7 @@ public static ImageSource Load(string path, bool loadFullImage = false)
181183
{ // we need to get image hash
182184
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
183185
if (hash != null)
184-
{
186+
{
185187
if (GuidToKey.TryGetValue(hash, out string key))
186188
{ // image already exists
187189
img = ImageCache[key];
@@ -195,7 +197,7 @@ public static ImageSource Load(string path, bool loadFullImage = false)
195197
// update cache
196198
ImageCache[path] = img;
197199
}
198-
200+
199201

200202
return img;
201203
}

0 commit comments

Comments
 (0)