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

case Theme::DATA_TYPE_ICON: {
			ur->add_do_method(*edited_theme, "rename_icon", p_item_name, new_name, edited_type);
			ur->add_undo_method(*edited_theme, "rename_icon", new_name, p_item_name, edited_type);
		} break;
		case Theme::DATA_TYPE_STYLEBOX: {
			ur->add_do_method(*edited_theme, "rename_stylebox", p_item_name, new_name, edited_type);
			ur->add_undo_method(*edited_theme, "rename_stylebox", new_name, p_item_name, edited_type);
			if (leading_stylebox.pinned && leading_stylebox.item_name == p_item_name) {
				leading_stylebox.item_name = new_name;
			}
		} break;
	}
	ur->commit_action();
}
void ThemeTypeEditor::_item_rename_entered(String p_value, int p_data_type, String p_item_name, Control *p_control) {
	_item_rename_confirmed(p_data_type, p_item_name, p_control);
}
void ThemeTypeEditor::_item_rename_canceled(int p_data_type, String p_item_name, Control *p_control) {
	
	Object::cast_to<LineEdit>(p_control->get_child(1))->hide();
	
	Object::cast_to<Button>(p_control->get_child(4))->hide();
	Object::cast_to<Button>(p_control->get_child(5))->hide();
	
	Object::cast_to<Label>(p_control->get_child(0))->show();
	
	Object::cast_to<Button>(p_control->get_child(2))->show();
	Object::cast_to<Button>(p_control->get_child(3))->show();
}
void ThemeTypeEditor::_color_item_changed(Color p_value, String p_item_name) {