Browse Source

Merge pull request #98597 from timothyqiu/on-your-lawn

Fix heap-use-after-free when ctrl-clicking controls in a container
Thaddeus Crews 9 months ago
parent
commit
6b70a6197f
1 changed files with 4 additions and 2 deletions
  1. 4 2
      editor/plugins/canvas_item_editor_plugin.cpp

+ 4 - 2
editor/plugins/canvas_item_editor_plugin.cpp

@@ -1464,10 +1464,12 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
 				List<CanvasItem *> selection = _get_edited_canvas_items(false, true, &has_locked_items);
 
 				// Remove not movable nodes
-				for (CanvasItem *E : selection) {
-					if (!_is_node_movable(E, true)) {
+				for (List<CanvasItem *>::Element *E = selection.front(); E;) {
+					List<CanvasItem *>::Element *N = E->next();
+					if (!_is_node_movable(E->get(), true)) {
 						selection.erase(E);
 					}
+					E = N;
 				}
 
 				drag_selection = selection;