### 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)

HBoxContainer *item_control = memnew(HBoxContainer);
	HBoxContainer *item_name_container = memnew(HBoxContainer);
	item_name_container->set_h_size_flags(SIZE_EXPAND_FILL);
	item_name_container->set_stretch_ratio(2.0);
	item_control->add_child(item_name_container);
	Label *item_name = memnew(Label);
	item_name->set_h_size_flags(SIZE_EXPAND_FILL);
	item_name->set_clip_text(true);
	item_name->set_text(p_item_name);
	item_name->set_tooltip_text(p_item_name);
	item_name_container->add_child(item_name);
	if (p_editable) {
		LineEdit *item_name_edit = memnew(LineEdit);
		item_name_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		item_name_edit->set_text(p_item_name);
		item_name_container->add_child(item_name_edit);
		item_name_edit->connect("text_submitted", callable_mp(this, &ThemeTypeEditor::_item_rename_entered).bind(p_data_type, p_item_name, item_name_container));
		item_name_edit->hide();
		Button *item_rename_button = memnew(Button);
		item_rename_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
		item_rename_button->set_tooltip_text(TTR("Rename Item"));
		item_rename_button->set_flat(true);
		item_name_container->add_child(item_rename_button);
		item_rename_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_cbk).bind(p_data_type, p_item_name, item_name_container));
		Button *item_remove_button = memnew(Button);
		item_remove_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
		item_remove_button->set_tooltip_text(TTR("Remove Item"));
		item_remove_button->set_flat(true);
		item_name_container->add_child(item_remove_button);