diff --git a/NanaZip.Shared/ModernWin32FileBrowser.cpp b/NanaZip.Shared/ModernWin32FileBrowser.cpp index b009d7730..54c84c770 100644 --- a/NanaZip.Shared/ModernWin32FileBrowser.cpp +++ b/NanaZip.Shared/ModernWin32FileBrowser.cpp @@ -51,24 +51,22 @@ EXTERN_C PIDLIST_ABSOLUTE WINAPI ModernSHBrowseForFolderW( nullptr, IID_PPV_ARGS(&DefaultFolder)))) { - if (SUCCEEDED(FileDialog->SetDefaultFolder( - DefaultFolder))) + FileDialog->SetDefaultFolder(DefaultFolder); + + DefaultFolder->Release(); + } + + if (SUCCEEDED(FileDialog->Show( + lpbi->hwndOwner))) + { + IShellItem* Result = nullptr; + if (SUCCEEDED(FileDialog->GetResult( + &Result))) { - if (SUCCEEDED(FileDialog->Show( - lpbi->hwndOwner))) - { - IShellItem* Result = nullptr; - if (SUCCEEDED(FileDialog->GetResult( - &Result))) - { - ::SHGetIDListFromObject(Result, &IDList); + ::SHGetIDListFromObject(Result, &IDList); - Result->Release(); - } - } + Result->Release(); } - - DefaultFolder->Release(); } } }