### Godot version

4.0.2

### System information

Windows 11

### Issue description

Changing node type from PopupMenu to ItemList causes Godot to crash

### Steps to reproduce

Change node type from PopupMenu to ItemList

### Minimal reproduction project

n/a
for (int i = 0; i < items.size(); i++) {
		if (items[i].shortcut.is_valid()) {
			_unref_shortcut(items[i].shortcut);
		}
	}
	items.clear();
	mouse_over = -1;
	control->queue_redraw();
	child_controls_changed();
	notify_property_list_changed();
	_menu_changed();
}
void PopupMenu::_ref_shortcut(Ref<Shortcut> p_sc) {
	if (!shortcut_refcount.has(p_sc)) {
		shortcut_refcount[p_sc] = 1;
		p_sc->connect("changed", callable_mp(this, &PopupMenu::_shortcut_changed));
	} else {
		shortcut_refcount[p_sc] += 1;
	}
}
void PopupMenu::_unref_shortcut(Ref<Shortcut> p_sc) {