Skip to content

Commit e55ea94

Browse files
committed
Merge pull request godotengine#99800 from amarsero/bone2d-redo-crash
Fix use after free in redo of "Create Custom Bone2D(s) from Node(s)"
2 parents b98eeb3 + d514ab2 commit e55ea94

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

editor/plugins/canvas_item_editor_plugin.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -4843,11 +4843,12 @@ void CanvasItemEditor::_popup_callback(int p_op) {
48434843
undo_redo->add_do_method(new_bone, "add_child", n2d);
48444844
undo_redo->add_do_method(n2d, "set_transform", Transform2D());
48454845
undo_redo->add_do_method(this, "_set_owner_for_node_and_children", new_bone, editor_root);
4846+
undo_redo->add_do_reference(new_bone);
48464847

48474848
undo_redo->add_undo_method(new_bone, "remove_child", n2d);
48484849
undo_redo->add_undo_method(n2d_parent, "add_child", n2d);
4850+
undo_redo->add_undo_method(n2d_parent, "remove_child", new_bone);
48494851
undo_redo->add_undo_method(n2d, "set_transform", new_bone->get_transform());
4850-
undo_redo->add_undo_method(new_bone, "queue_free");
48514852
undo_redo->add_undo_method(this, "_set_owner_for_node_and_children", n2d, editor_root);
48524853
}
48534854
undo_redo->commit_action();

0 commit comments

Comments
 (0)