Pārlūkot izejas kodu

Fix use after free in the editor inspector section cleanup.

(cherry picked from commit c7ca36b827eaad25a6a911747e83d893301b4da9)
bruvzg 5 mēneši atpakaļ
vecāks
revīzija
6d45d6265b
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      editor/editor_inspector.cpp

+ 2 - 1
editor/editor_inspector.cpp

@@ -3921,8 +3921,9 @@ void EditorInspector::update_tree() {
 		}
 		}
 
 
 		// Clean up empty sections.
 		// Clean up empty sections.
-		for (List<EditorInspectorSection *>::Element *I = sections.back(); I; I = I->prev()) {
+		for (List<EditorInspectorSection *>::Element *I = sections.back(); I;) {
 			EditorInspectorSection *section = I->get();
 			EditorInspectorSection *section = I->get();
+			I = I->prev(); // Note: Advance before erasing element.
 			if (section->get_vbox()->get_child_count() == 0) {
 			if (section->get_vbox()->get_child_count() == 0) {
 				sections.erase(section);
 				sections.erase(section);
 				vbox_per_path[main_vbox].erase(section->get_section());
 				vbox_per_path[main_vbox].erase(section->get_section());