[BUG] ArgumentOutOfRangeException & ObjectDisposedException at NativeWindow.Callback (#172, #173), version 1.0.17.49

This commit is contained in:
Markus Hofknecht 2021-05-29 09:25:37 +02:00
parent 0241f9c93c
commit 366acc27ad
3 changed files with 10 additions and 4 deletions

View file

@ -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;
}

View file

@ -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")]

View file

@ -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);