mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-03 02:55:17 +12:00
[BUG] ArgumentOutOfRangeException & ObjectDisposedException at NativeWindow.Callback (#172, #173), version 1.0.17.52
This commit is contained in:
parent
642b3a731e
commit
b12ca85489
|
@ -148,10 +148,8 @@ namespace SystemTrayMenu.DataClasses
|
||||||
{
|
{
|
||||||
icon = IconReader.GetFileIconWithCache(
|
icon = IconReader.GetFileIconWithCache(
|
||||||
TargetFilePath,
|
TargetFilePath,
|
||||||
showOverlay,
|
showOverlay);
|
||||||
false,
|
diposeIcon = false;
|
||||||
out bool toDispose);
|
|
||||||
diposeIcon = toDispose;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -334,8 +332,8 @@ namespace SystemTrayMenu.DataClasses
|
||||||
{
|
{
|
||||||
if (FileUrl.GetDefaultBrowserPath(out string browserPath))
|
if (FileUrl.GetDefaultBrowserPath(out string browserPath))
|
||||||
{
|
{
|
||||||
icon = IconReader.GetFileIconWithCache(browserPath, true, true, out bool toDispose);
|
icon = IconReader.GetFileIconWithCache(browserPath, true);
|
||||||
diposeIcon = toDispose;
|
diposeIcon = false;
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.17.51")]
|
[assembly: AssemblyVersion("1.0.17.52")]
|
||||||
[assembly: AssemblyFileVersion("1.0.17.51")]
|
[assembly: AssemblyFileVersion("1.0.17.52")]
|
||||||
|
|
|
@ -47,31 +47,24 @@ namespace SystemTrayMenu.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Icon GetFileIconWithCache(string filePath, bool linkOverlay, bool isBrowser, out bool toDispose)
|
public static Icon GetFileIconWithCache(string filePath, bool linkOverlay)
|
||||||
{
|
{
|
||||||
Icon icon = null;
|
Icon icon = null;
|
||||||
string extension = Path.GetExtension(filePath);
|
string extension = Path.GetExtension(filePath);
|
||||||
IconSize size = IconSize.Small;
|
IconSize size = IconSize.Small;
|
||||||
|
|
||||||
if (isBrowser)
|
|
||||||
{
|
|
||||||
extension = "DefaultBrowserPath";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsExtensionWitSameIcon(extension))
|
if (IsExtensionWitSameIcon(extension))
|
||||||
{
|
{
|
||||||
icon = DictIconCache.GetOrAdd(extension + linkOverlay, GetIcon);
|
icon = DictIconCache.GetOrAdd(extension + linkOverlay, GetIcon);
|
||||||
Icon GetIcon(string keyExtension)
|
|
||||||
{
|
|
||||||
return GetFileIconSTA(filePath, linkOverlay, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
toDispose = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
icon = GetFileIconSTA(filePath, linkOverlay, size);
|
icon = DictIconCache.GetOrAdd(filePath, GetIcon);
|
||||||
toDispose = true;
|
}
|
||||||
|
|
||||||
|
Icon GetIcon(string keyExtension)
|
||||||
|
{
|
||||||
|
return GetFileIconSTA(filePath, linkOverlay, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
|
|
Loading…
Reference in a new issue