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

node_sprite_2d = Object::cast_to<Sprite2D>(p_obj);
		node_sprite_3d = Object::cast_to<Sprite3D>(p_obj);
		node_ninepatch = Object::cast_to<NinePatchRect>(p_obj);
		bool is_resource = false;
		if (Object::cast_to<StyleBoxTexture>(p_obj)) {
			obj_styleBox = Ref<StyleBoxTexture>(Object::cast_to<StyleBoxTexture>(p_obj));
			is_resource = true;
		}
		if (Object::cast_to<AtlasTexture>(p_obj)) {
			atlas_tex = Ref<AtlasTexture>(Object::cast_to<AtlasTexture>(p_obj));
			is_resource = true;
		}
		if (is_resource) {
			p_obj->connect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
		} else {
			p_obj->connect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
		}
		_edit_region();
	}
	edit_draw->queue_redraw();
	popup_centered_ratio(0.5);
	request_center = true;
}
void TextureRegionEditor::_texture_changed() {
	if (!is_visible()) {
		return;
	}
	_edit_region();
}
void TextureRegionEditor::_edit_region() {