From 75446fc4d0acbd1822b4add71ecfb901015fcfad Mon Sep 17 00:00:00 2001 From: xuhuisheng Date: Sun, 19 Oct 2025 13:30:04 +0800 Subject: [PATCH] Fix switch to GameView when closing game window --- editor/run/game_view_plugin.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cpp index d68468d13a0..1b80095a7b0 100644 --- a/editor/run/game_view_plugin.cpp +++ b/editor/run/game_view_plugin.cpp @@ -1160,6 +1160,9 @@ void GameView::_update_arguments_for_instance(int p_idx, List &r_argumen void GameView::_window_close_request() { if (window_wrapper->get_window_enabled()) { + // Stop the embedded process timer before closing the window wrapper, + // so the signal to focus EDITOR_GAME isn't sent when the window is not enabled. + embedded_process->reset(); window_wrapper->set_window_enabled(false); } @@ -1169,7 +1172,6 @@ void GameView::_window_close_request() { // When the embedding is not complete, we need to kill the process. // If the game is paused, the close request will not be processed by the game, so it's better to kill the process. if (paused || embedded_process->is_embedding_in_progress()) { - embedded_process->reset(); // Call deferred to prevent the _stop_pressed callback to be executed before the wrapper window // actually closes. callable_mp(EditorRunBar::get_singleton(), &EditorRunBar::stop_playing).call_deferred();