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

CanvasItem::TextureFilter filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
	Ref<Texture2D> texture = nullptr;
	if (atlas_tex.is_valid()) {
		texture = atlas_tex->get_atlas();
	} else if (node_sprite_2d) {
		texture = node_sprite_2d->get_texture();
		filter = node_sprite_2d->get_texture_filter_in_tree();
	} else if (node_sprite_3d) {
		texture = node_sprite_3d->get_texture();
		StandardMaterial3D::TextureFilter filter_3d = node_sprite_3d->get_texture_filter();
		switch (filter_3d) {
			case StandardMaterial3D::TEXTURE_FILTER_NEAREST:
				filter = CanvasItem::TEXTURE_FILTER_NEAREST;
				break;
			case StandardMaterial3D::TEXTURE_FILTER_LINEAR:
				filter = CanvasItem::TEXTURE_FILTER_LINEAR;
				break;
			case StandardMaterial3D::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
				filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
				break;
			case StandardMaterial3D::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
				filter = CanvasItem::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
				break;
			case StandardMaterial3D::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC:
				filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC;
				break;
			case StandardMaterial3D::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC:
				filter = CanvasItem::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC;
				break;