Skip to content

Commit 8a05c60

Browse files
committed
Fix possible double release
1 parent 49fc0b8 commit 8a05c60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Flow.Launcher.Infrastructure/Image/ThumbnailReader.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ private static unsafe HBITMAP GetHBitmap(string fileName, int width, int height,
6262
if (nativeShellItem is not IShellItemImageFactory imageFactory)
6363
{
6464
Marshal.ReleaseComObject(nativeShellItem);
65+
nativeShellItem = null;
6566
throw new InvalidOperationException("Failed to get IShellItemImageFactory");
6667
}
6768

@@ -86,7 +87,10 @@ private static unsafe HBITMAP GetHBitmap(string fileName, int width, int height,
8687
}
8788
finally
8889
{
89-
Marshal.ReleaseComObject(nativeShellItem);
90+
if (nativeShellItem != null)
91+
{
92+
Marshal.ReleaseComObject(nativeShellItem);
93+
}
9094
}
9195

9296
return hBitmap;

0 commit comments

Comments
 (0)