[BUG] COMException (0x8000FFFF) when exit while folder dialog open (#233), version 1.0.25.6

This commit is contained in:
Markus Hofknecht 2021-11-12 13:41:15 +01:00
parent 6d8cf4da39
commit e4f3d6b67a
2 changed files with 21 additions and 14 deletions

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.25.5")]
[assembly: AssemblyFileVersion("1.0.25.5")]
[assembly: AssemblyVersion("1.0.25.6")]
[assembly: AssemblyFileVersion("1.0.25.6")]

View file

@ -85,26 +85,33 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
if (owner != null && frm.Show(owner.Handle) == NativeMethods.S_OK)
{
if (frm.GetResult(out NativeMethods.IShellItem shellItem) == NativeMethods.S_OK)
try
{
if (shellItem.GetDisplayName(
NativeMethods.SIGDN_FILESYSPATH,
out IntPtr pszString) == NativeMethods.S_OK)
if (frm.GetResult(out NativeMethods.IShellItem shellItem) == NativeMethods.S_OK)
{
if (pszString != IntPtr.Zero)
if (shellItem.GetDisplayName(
NativeMethods.SIGDN_FILESYSPATH,
out IntPtr pszString) == NativeMethods.S_OK)
{
try
if (pszString != IntPtr.Zero)
{
Folder = Marshal.PtrToStringAuto(pszString);
return DialogResult.OK;
}
finally
{
Marshal.FreeCoTaskMem(pszString);
try
{
Folder = Marshal.PtrToStringAuto(pszString);
return DialogResult.OK;
}
finally
{
Marshal.FreeCoTaskMem(pszString);
}
}
}
}
}
catch (Exception ex)
{
Log.Warn("Folder Dialog failed", ex);
}
}
return DialogResult.Cancel;