-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform team
Description
Background
Flutter 3.10 app startup has a race condition that can result in the window not being shown. #127046 updated the app template to fix this issue. Windows projects will need to be updated after the next Flutter release. An automatic migration was added for projects that have not modified their Windows entry point. However, the automatic migration may not be able to modify projects that have modified their Windows entry point.
Part of: #119415
See: #127046 (comment)
Solution
After the next Flutter release, document how to do this migration manually.
Example migration:
diff --git a/examples/hello_world/windows/runner/flutter_window.cpp b/examples/hello_world/windows/runner/flutter_window.cpp
index f68aa9c26c0f5..7f66913a0293c 100644
--- a/examples/hello_world/windows/runner/flutter_window.cpp
+++ b/examples/hello_world/windows/runner/flutter_window.cpp
@@ -35,6 +35,11 @@ bool FlutterWindow::OnCreate() {
this->Show();
});
+ // Flutter can complete the first frame before the "show window" callback is
+ // registered. The following call ensures a frame is pending to ensure the
+ // window is shown. It is a no-op if the first frame hasn't completed yet.
+ flutter_controller_->ForceRedraw();
+
return true;
}Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform team