Skip to content

Commit c7ca36b

Browse files
committed
Fix use after free in the editor inspector section cleanup.
1 parent 3d9b05a commit c7ca36b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

editor/editor_inspector.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3941,8 +3941,9 @@ void EditorInspector::update_tree() {
39413941
}
39423942

39433943
// Clean up empty sections.
3944-
for (List<EditorInspectorSection *>::Element *I = sections.back(); I; I = I->prev()) {
3944+
for (List<EditorInspectorSection *>::Element *I = sections.back(); I;) {
39453945
EditorInspectorSection *section = I->get();
3946+
I = I->prev(); // Note: Advance before erasing element.
39463947
if (section->get_vbox()->get_child_count() == 0) {
39473948
sections.erase(section);
39483949
vbox_per_path[main_vbox].erase(section->get_section());

0 commit comments

Comments
 (0)