Skip to content
Closed
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
10 changes: 6 additions & 4 deletions windows/runner/flutter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ void SetWindowAppUserModelId(HWND hwnd) {
}

bool IsBotGuardWindow(HWND hwnd) {
if (hwnd == nullptr || !::IsWindow(hwnd)) return false;
DWORD pid = 0;
::GetWindowThreadProcessId(hwnd, &pid);
if (pid != ::GetCurrentProcessId()) return false;
// The WebView plugin creates its windows on the platform thread.
// GetWindowTextW sends WM_GETTEXT synchronously to in-process windows,
// so querying a worker window can stall the platform thread indefinitely.
if (::GetWindowThreadProcessId(hwnd, nullptr) != ::GetCurrentThreadId()) {
return false;
}
wchar_t title[128]{};
int len = ::GetWindowTextW(hwnd, title, 128);
if (len <= 0) return false;
Expand Down