From 4b105ec88f3bbb34c2b97e009275489cadba988d Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Tue, 21 Apr 2026 21:47:05 +0800 Subject: [PATCH] fix(new_editor): stabilize detached window close lifecycle --- new_editor/app/Platform/Win32/EditorWindow.cpp | 4 +++- .../Win32/WindowManager/EditorWindowMessageDispatcher.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/new_editor/app/Platform/Win32/EditorWindow.cpp b/new_editor/app/Platform/Win32/EditorWindow.cpp index 1c867652..2bae9230 100644 --- a/new_editor/app/Platform/Win32/EditorWindow.cpp +++ b/new_editor/app/Platform/Win32/EditorWindow.cpp @@ -233,7 +233,9 @@ bool EditorWindow::Initialize( void EditorWindow::Shutdown() { ForceReleasePointerCapture(); - m_runtime->Shutdown(); + if (m_runtime->IsReady()) { + m_runtime->Shutdown(); + } m_inputController->ClearPendingEvents(); m_chromeController->Reset(); } diff --git a/new_editor/app/Platform/Win32/WindowManager/EditorWindowMessageDispatcher.cpp b/new_editor/app/Platform/Win32/WindowManager/EditorWindowMessageDispatcher.cpp index 21f7385e..d00c33d6 100644 --- a/new_editor/app/Platform/Win32/WindowManager/EditorWindowMessageDispatcher.cpp +++ b/new_editor/app/Platform/Win32/WindowManager/EditorWindowMessageDispatcher.cpp @@ -386,6 +386,13 @@ bool EditorWindowMessageDispatcher::TryDispatchWindowLifecycleMessage( } outResult = 0; return true; + case WM_CLOSE: + if (!context.window.IsClosing()) { + context.window.MarkClosing(); + } + DestroyWindow(context.hwnd); + outResult = 0; + return true; case WM_PAINT: if (EditorWindowFrameTransferRequests transferRequests = context.window.OnPaintMessage( context.hostRuntime.GetEditorContext(),