### Godot version

4.0.dev (c309de53997feff3286295fb2d71657f112a15db)

### System information

Linux, Nvidia, Vulkan

### Issue description

Editor segfaults when certain conditions are met when using the AnimationPlayer editor.

### Steps to reproduce

1. Create multiple animations, saved into a animation collection
2. Open an existing animation, then make a new empty animation
3. Change from seconds to fps, or add a new property to animate ()
4. Editor crashes

NOTE: It is slightly random and I have not found a perfect repro

### Minimal reproduction project

N/A (TBD?)
if (mm.is_valid() && box_selecting) {
		if (!mm->get_button_mask().has_flag(MouseButtonMask::LEFT)) {
			
			box_selection->hide();
			box_selecting = false;
			return;
		}
		if (!box_selection->is_visible_in_tree()) {
			if (!mm->is_command_or_control_pressed() && !mm->is_shift_pressed()) {
				_clear_selection(true);
			}
			box_selection->show();
		}
		Vector2 from = box_selecting_from;
		Vector2 to = scroll->get_global_transform().xform(mm->get_position());
		if (from.x > to.x) {
			SWAP(from.x, to.x);
		}
		if (from.y > to.y) {
			SWAP(from.y, to.y);
		}
		Rect2 rect(from, to - from);
		Rect2 scroll_rect = Rect2(scroll->get_global_position(), scroll->get_size());
		rect = scroll_rect.intersection(rect);
		box_selection->set_position(rect.position);
		box_selection->set_size(rect.size);
		box_select_rect = rect;
	}
}
void AnimationTrackEditor::_toggle_bezier_edit() {