### Godot version

4.0.3.stable

### System information

Windows 10/11

### Issue description

I want the player's cursor to change when highlighting pickable Area2Ds; to do this, I have the areas modify the `mouse_default_cursor_shape` property on an external Control when the mouse enters or exits. If another Control appears in front of the Area2D while the mouse is over it, there is a chance that the project will crash.

Nothing prints to the IDE's output on this crash. If running the editor with console, then
```
ERROR: Condition "slot >= slot_max" is true. Returning: nullptr
   at: get_instance (./core/object/object.h:972)
```
will sometimes appear alongside the crash. If it appears, it always appears twice.

When I run a debug build of the editor through WinDbg, WinDbg will catch the following exception:
```
(3b58.2aac): Access violation - code c0000005 (!!! second chance !!!)
godot_windows_editor_x86_64!ObjectDB::get_instance [inlined in godot_windows_editor_x86_64!Viewport::_cleanup_mouseover_colliders+0x6f]:
00007ff6`ac254a1f 488b5310        mov     rdx,qword ptr [rbx+10h] ds:cccccccc`c31c419b=????????????????
```
When using this method, the exception is not random; it always occurs on the first attempt.

### Steps to reproduce

- Open the minimal reproduction project in the editor.
- Run the project.
- Click on the Area2D (you'll want visible collision shapes on).
- A full-screen button will pop up. If the game does not crash at this point, clicking the button will hide it so you can try again. It should crash within a few seconds of mashing.

### Minimal reproduction project

[Crash Test.zip](https://github.com/godotengine/godot/files/12027772/Crash.Test.zip)

set_positional_shadow_atlas_quadrant_subdiv(1, SHADOW_ATLAS_QUADRANT_SUBDIV_4);
	set_positional_shadow_atlas_quadrant_subdiv(2, SHADOW_ATLAS_QUADRANT_SUBDIV_16);
	set_positional_shadow_atlas_quadrant_subdiv(3, SHADOW_ATLAS_QUADRANT_SUBDIV_64);
	set_mesh_lod_threshold(mesh_lod_threshold);
	String id = itos(get_instance_id());
	input_group = "_vp_input" + id;
	gui_input_group = "_vp_gui_input" + id;
	unhandled_input_group = "_vp_unhandled_input" + id;
	shortcut_input_group = "_vp_shortcut_input" + id;
	unhandled_key_input_group = "_vp_unhandled_key_input" + id;
	// Window tooltip.
	gui.tooltip_delay = GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5);
#ifndef _3D_DISABLED
	set_scaling_3d_mode((Viewport::Scaling3DMode)(int)GLOBAL_GET("rendering/scaling_3d/mode"));
	set_scaling_3d_scale(GLOBAL_GET("rendering/scaling_3d/scale"));
	set_fsr_sharpness((float)GLOBAL_GET("rendering/scaling_3d/fsr_sharpness"));
	set_texture_mipmap_bias((float)GLOBAL_GET("rendering/textures/default_filters/texture_mipmap_bias"));
#endif 
	set_sdf_oversize(sdf_oversize); // Set to server.
}
Viewport::~Viewport() {
	// Erase itself from viewport textures.
	for (ViewportTexture *E : viewport_textures) {
		E->vp = nullptr;
	}
	ERR_FAIL_NULL(RenderingServer::get_singleton());
	RenderingServer::get_singleton()->free(viewport);
}
//
void SubViewport::set_size(const Size2i &p_size) {