Reimplemented scene editor window caching to fix crash when closing one during iteration

This commit is contained in:
antopilo
2025-02-02 10:31:08 -05:00
parent bb7d7aafbc
commit 21647c27cf

View File

@@ -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<Ref<SceneEditorWindow>> cachedEditors = sceneEditors;
for (auto& sceneEditor : cachedEditors)
{
sceneEditor->Draw();
}