From 7e638a7a276e0a13d49d15d98ed46138727c188d Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 11 Nov 2026 14:37:32 +0800 Subject: [PATCH] Windows: answer WM_GETOBJECT with the system's default, not the engine's Another app's UI Automation hit test crashed the app in the engine's FlutterPlatformNodeDelegateWindows::HitTestSync (a child AX node with no delegate, flutter/flutter#195653). The engine also turns semantics on at the first such query and keeps them on. The app makes no claim to support screen readers, so the view no longer hands out its accessibility tree. Co-Authored-By: BaoCode --- windows/runner/view_window.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/windows/runner/view_window.cpp b/windows/runner/view_window.cpp index 158d275e1..fd1e712c5 100644 --- a/windows/runner/view_window.cpp +++ b/windows/runner/view_window.cpp @@ -219,6 +219,18 @@ LRESULT CALLBACK ViewWindow::ViewProc(HWND hwnd, UINT const message, auto* that = static_cast(GetThisFromHandle(::GetParent(hwnd))); + // Other apps asking for the view's accessibility objects (screen readers, + // and input methods, translators and the like that read what is on screen) + // get the system's plain answer for a window, not the engine's. The engine + // turns Flutter's semantics on at the first such question and keeps them on, + // which costs every frame (PipelineOwner.flushSemantics), and its hit test + // over that tree crashes on a child it has no node for + // (FlutterPlatformNodeDelegateWindows::HitTestSync, flutter/flutter#195653). + // The app makes no claim to work with screen readers. + if (message == WM_GETOBJECT) { + return ::DefWindowProcW(hwnd, message, wparam, lparam); + } + // The cursor's position, over the parts of the window that are the // window's own, is this window's to answer — its buttons, and the strip // Flutter draws the header in. The view is a child window over the whole