Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/shell/script/binding_types_com.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ CComPtr<IShellBrowser> GetIShellBrowserRecursive(HWND hWnd) {

std::unordered_set<HWND> recorded_hwnds;

static auto browsers = GetIShellBrowsers();
// Enumerate fresh each call: a static cache goes stale as explorer windows
// open/close and HWNDs are recycled, which made the first right-click in a
// new window resolve to the desktop or a previous location.
auto browsers = GetIShellBrowsers();
auto GetIShellBrowser = [&](HWND hwnd) -> CComPtr<IShellBrowser> {
for (auto &[h, b] : browsers) {
CComPtr<IShellView> psv;
Expand Down