Skip to content

[win32] Implement hot restart for multi-window - #193225

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
knopp:win_hot_restart
Sep 23, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
knopp:win_hot_restart

Conversation

@knopp

@knopp knopp commented Sep 23, 2026

Copy link
Copy Markdown
Member

This PR implements hot restart for multi-window and fixes a introduces a more robust solution for delaying the FlutterView HWND destruction.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@knopp
knopp requested a review from a team as a code owner September 23, 2026 16:05
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 23, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically a: desktop Running on desktop team-windows Owned by the Windows platform team labels Sep 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces OnPreEngineRestart to handle window destruction during hot restarts without dispatching messages to the isolate, refactors window destruction logic in OnEngineShutdown and HandleMessage, and adds corresponding unit tests. Feedback suggests addressing a potential infinite loop risk in OnEngineShutdown if window destruction fails, and adding a null check for the Flutter view window handle in HandleMessage to prevent calling Windows API functions with a null handle.

Comment thread engine/src/flutter/shell/platform/windows/window_manager.cc
Comment thread engine/src/flutter/shell/platform/windows/window_manager.cc

@mattkae mattkae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good by me!

@mattkae mattkae added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 23, 2026
Merged via the queue into flutter:master with commit 6f1744a Sep 23, 2026
27 of 28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically team-windows Owned by the Windows platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants