From b3b894eaa19c522a4c4fcd42f2f5b5d0eff844c2 Mon Sep 17 00:00:00 2001 From: fanlusky <1730976608@qq.com> Date: Wed, 8 Jul 2026 14:09:19 +0800 Subject: [PATCH] [Regression]: Fix the candidate window residue issue in UWP applications. --- src/UI/CandidateListUIPresenter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/UI/CandidateListUIPresenter.cpp b/src/UI/CandidateListUIPresenter.cpp index fbef55ce..dcff1ebf 100644 --- a/src/UI/CandidateListUIPresenter.cpp +++ b/src/UI/CandidateListUIPresenter.cpp @@ -1041,6 +1041,11 @@ VOID CCandidateListUIPresenter::_LayoutChangeNotification(_In_ RECT *lpRect) { lpRect; PerfTimer timer; + if (_asyncCleanupPending || !_candidateUiSessionActive) + { + // In UWP, layout updates can still arrive after candidate UI teardown; ignore them so the window stays hidden. + return; + } MoveCandidateUiSession(); } @@ -1326,6 +1331,11 @@ void CCandidateListUIPresenter::UpdateCandidateUiSession() void CCandidateListUIPresenter::MoveCandidateUiSession() { PerfTimer timer; + if (_asyncCleanupPending || !_candidateUiSessionActive) + { + // Once teardown starts, do not send further move events or the candidate window may linger on screen. + return; + } PerfTimer writePayloadTimer; WriteCandidateUiPayload(0b001000); double writePayloadElapsedMs = writePayloadTimer.ElapsedMs();