From 21647c27cf8c58acdbeb92e21d975cc05dd83717 Mon Sep 17 00:00:00 2001 From: antopilo Date: Sun, 2 Feb 2025 10:31:08 -0500 Subject: [PATCH] Reimplemented scene editor window caching to fix crash when closing one during iteration --- Editor/Source/Editor/Windows/EditorInterface.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Editor/Source/Editor/Windows/EditorInterface.cpp b/Editor/Source/Editor/Windows/EditorInterface.cpp index 254eddb8..29595be2 100644 --- a/Editor/Source/Editor/Windows/EditorInterface.cpp +++ b/Editor/Source/Editor/Windows/EditorInterface.cpp @@ -2787,8 +2787,9 @@ namespace Nuake { SceneEditorDockspaceNodeID = ImGui::DockBuilderAddNode(dockspaceId, ImGuiDockNodeFlags_DockSpace); } - // We need to cache, because we might delete one while iterating - for (auto& sceneEditor : sceneEditors) + // We need to make a copy, because we might delete one while iterating + std::vector> cachedEditors = sceneEditors; + for (auto& sceneEditor : cachedEditors) { sceneEditor->Draw(); }