### Godot version

v4.0.beta17.mono.official [c40020513]

### System information

Window 11, Forward+, GTX 1060

### Issue description

Adding two theme variations in a row result to a  crash.

https://user-images.githubusercontent.com/93253123/217037249-1ce1d56d-beb6-4435-83ad-9f8a07fe0e96.mp4



### Steps to reproduce

1. Create a project.
2. Create a theme.
3. Double click to go in the theme editor.
4. Click on manage items buttons.
5. In the add type field type a name to add a type.
6. type another name to add a second type.
7. Crash.

### Minimal reproduction project

[ThemeVariationCrash.zip](https://github.com/godotengine/godot/files/10665863/ThemeVariationCrash.zip)

type_variation_vb->add_child(type_variation_hb);
	Label *type_variation_label = memnew(Label);
	type_variation_hb->add_child(type_variation_label);
	type_variation_label->set_text(TTR("Base Type"));
	type_variation_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	type_variation_edit = memnew(LineEdit);
	type_variation_hb->add_child(type_variation_edit);
	type_variation_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	type_variation_edit->connect("text_changed", callable_mp(this, &ThemeTypeEditor::_type_variation_changed));
	type_variation_edit->connect("focus_exited", callable_mp(this, &ThemeTypeEditor::_update_type_items));
	type_variation_button = memnew(Button);
	type_variation_hb->add_child(type_variation_button);
	type_variation_button->set_tooltip_text(TTR("Select the variation base type from a list of available types."));
	type_variation_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_type_variation_cbk));
	type_variation_locked = memnew(Label);
	type_variation_vb->add_child(type_variation_locked);
	type_variation_locked->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
	type_variation_locked->set_autowrap_mode(TextServer::AUTOWRAP_WORD);
	type_variation_locked->set_text(TTR("A type associated with a built-in class cannot be marked as a variation of another type."));
	type_variation_locked->hide();
	add_type_dialog = memnew(ThemeTypeDialog);
	add_child(add_type_dialog);
	add_type_dialog->connect("type_selected", callable_mp(this, &ThemeTypeEditor::_add_type_dialog_selected));
	update_debounce_timer = memnew(Timer);
	update_debounce_timer->set_one_shot(true);
	update_debounce_timer->set_wait_time(0.5);
	update_debounce_timer->connect("timeout", callable_mp(this, &ThemeTypeEditor::_update_type_list));
	add_child(update_debounce_timer);
}
void ThemeEditor::edit(const Ref<Theme> &p_theme) {