From c7ca36b827eaad25a6a911747e83d893301b4da9 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:37:26 +0200 Subject: [PATCH] Fix use after free in the editor inspector section cleanup. --- editor/editor_inspector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 8ad90dd0a2e..c52f1afdb36 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3941,8 +3941,9 @@ void EditorInspector::update_tree() { } // Clean up empty sections. - for (List::Element *I = sections.back(); I; I = I->prev()) { + for (List::Element *I = sections.back(); I;) { EditorInspectorSection *section = I->get(); + I = I->prev(); // Note: Advance before erasing element. if (section->get_vbox()->get_child_count() == 0) { sections.erase(section); vbox_per_path[main_vbox].erase(section->get_section());