From 366acc27adf5c7481f17e4a287a6ef6b8c223222 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sat, 29 May 2021 09:25:37 +0200 Subject: [PATCH] [BUG] ArgumentOutOfRangeException & ObjectDisposedException at NativeWindow.Callback (#172, #173), version 1.0.17.49 --- DataClasses/RowData.cs | 3 ++- Properties/AssemblyInfo.cs | 4 ++-- Utilities/File/IconReader.cs | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/DataClasses/RowData.cs b/DataClasses/RowData.cs index f3eb64a..1cb0317 100644 --- a/DataClasses/RowData.cs +++ b/DataClasses/RowData.cs @@ -149,6 +149,7 @@ namespace SystemTrayMenu.DataClasses icon = IconReader.GetFileIconWithCache( TargetFilePath, showOverlay, + false, out bool toDispose); diposeIcon = toDispose; } @@ -333,7 +334,7 @@ namespace SystemTrayMenu.DataClasses { if (FileUrl.GetDefaultBrowserPath(out string browserPath)) { - icon = IconReader.GetFileIconWithCache(browserPath, true, out bool toDispose); + icon = IconReader.GetFileIconWithCache(browserPath, true, true, out bool toDispose); diposeIcon = toDispose; handled = true; } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index ba7fc32..f3cc382 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.17.48")] -[assembly: AssemblyFileVersion("1.0.17.48")] +[assembly: AssemblyVersion("1.0.17.49")] +[assembly: AssemblyFileVersion("1.0.17.49")] diff --git a/Utilities/File/IconReader.cs b/Utilities/File/IconReader.cs index e89e419..7f06daf 100644 --- a/Utilities/File/IconReader.cs +++ b/Utilities/File/IconReader.cs @@ -47,12 +47,17 @@ namespace SystemTrayMenu.Utilities } } - public static Icon GetFileIconWithCache(string filePath, bool linkOverlay, out bool toDispose) + public static Icon GetFileIconWithCache(string filePath, bool linkOverlay, bool isBrowser, out bool toDispose) { Icon icon = null; string extension = Path.GetExtension(filePath); IconSize size = IconSize.Small; + if (isBrowser) + { + extension = "DefaultBrowserPath"; + } + if (IsExtensionWitSameIcon(extension)) { icon = DictIconCache.GetOrAdd(extension + linkOverlay, GetIcon);