### Godot version

 v4.0.beta11.official.91713ced8

### System information

macOS 12.6.1 Monterey, Apple M1 Pro

### Issue description

After reopening scenes with Sprite2D and trying to edit the region of the sprite again the Godot app crashed.

### Steps to reproduce

1. Open scene node_2d in the project files
2. Go to Sprite2D and click on edit region, pop up should show
3. Close the popup and close the scene with X on the tab
4. Reopen the scene, go to Sprite2D and click on Edit region
5. Godot should crash

### Minimal reproduction project

[region_crash.zip](https://github.com/godotengine/godot/files/10400566/region_crash.zip)

if (p_obj == node_sprite_2d || p_obj == node_sprite_3d || p_obj == node_ninepatch || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
		node_sprite_2d = nullptr;
		node_sprite_3d = nullptr;
		node_ninepatch = nullptr;
		obj_styleBox = Ref<StyleBox>(nullptr);
		atlas_tex = Ref<AtlasTexture>(nullptr);
		hide();
	}
}
void TextureRegionEditor::_bind_methods() {
	ClassDB::bind_method(D_METHOD("_edit_region"), &TextureRegionEditor::_edit_region);
	ClassDB::bind_method(D_METHOD("_node_removed"), &TextureRegionEditor::_node_removed);
	ClassDB::bind_method(D_METHOD("_zoom_on_position"), &TextureRegionEditor::_zoom_on_position);
	ClassDB::bind_method(D_METHOD("_update_rect"), &TextureRegionEditor::_update_rect);
}
bool TextureRegionEditor::is_stylebox() {
	return obj_styleBox.is_valid();
}
bool TextureRegionEditor::is_atlas_texture() {
	return atlas_tex.is_valid();
}
bool TextureRegionEditor::is_ninepatch() {