### Godot version

master

### System information

PopOs 22.04, Nvidia

### Issue description

Under some conditions, adding a new animation to an AnimationFrame resource crashes the engine.
This happens only after restarting the engine, and trying to add a new animation on an AnimationFrame


https://github.com/godotengine/godot/assets/3624853/2586869b-bf0a-4840-a75a-f38f9c0bf649


Crash log : 

```
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.dev.custom_build (dc46163b121993229fedc7853000bd9bcb9ec2de)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f1e1f242520] (??:0)
[2] HashMap<StringName, SpriteFrames::Anim, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, SpriteFrames::Anim> > >::_lookup_pos(StringName const&, unsigned int&) const (/Projects/godot/./core/templates/hash_map.h:100)
[3] HashMap<StringName, SpriteFrames::Anim, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, SpriteFrames::Anim> > >::has(StringName const&) const (/Projects/godot/./core/templates/hash_map.h:310)
[4] SpriteFrames::has_animation(StringName const&) const (/Projects/godot/scene/resources/sprite_frames.cpp:106)
[5] SpriteFramesEditor::_animation_add() (/Projects/godot/editor/plugins/sprite_frames_editor_plugin.cpp:1001)
[6] void call_with_variant_args_helper<SpriteFramesEditor>(SpriteFramesEditor*, void (SpriteFramesEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (/Projects/godot/./core/variant/binder_common.h:308)
[7] void call_with_variant_args<SpriteFramesEditor>(SpriteFramesEditor*, void (SpriteFramesEditor::*)(), Variant const**, int, Callable::CallError&) (/Projects/godot/./core/variant/binder_common.h:418)
[8] CallableCustomMethodPointer<SpriteFramesEditor>::call(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/./core/object/callable_method_pointer.h:105)
[9] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/core/variant/callable.cpp:51)
[10] Object::emit_signalp(StringName const&, Variant const**, int) (/Projects/godot/core/object/object.cpp:1068)
[11] Error Object::emit_signal<>(StringName const&) (/Projects/godot/./core/object/object.h:870)
[12] BaseButton::_pressed() (/Projects/godot/scene/gui/base_button.cpp:139)
[13] BaseButton::on_action_event(Ref<InputEvent>) (??:?)
[14] BaseButton::gui_input(Ref<InputEvent> const&) (/Projects/godot/scene/gui/base_button.cpp:69)
[15] Control::_call_gui_input(Ref<InputEvent> const&) (/Projects/godot/scene/gui/control.cpp:1752)
[16] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (/Projects/godot/scene/main/viewport.cpp:1511)
[17] Viewport::_gui_input_event(Ref<InputEvent>) (/Projects/godot/scene/main/viewport.cpp:1781)
[18] Viewport::push_input(Ref<InputEvent> const&, bool) (/Projects/godot/scene/main/viewport.cpp:2944)
[19] Window::_window_input(Ref<InputEvent> const&) (/Projects/godot/scene/main/window.cpp:1389)
[20] void call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/Projects/godot/./core/variant/binder_common.h:303)
[21] void call_with_variant_args<Window, Ref<InputEvent> const&>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, int, Callable::CallError&) (/Projects/godot/./core/variant/binder_common.h:418)
[22] CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/./core/object/callable_method_pointer.h:105)
[23] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/core/variant/callable.cpp:51)
[24] DisplayServerX11::_dispatch_input_event(Ref<InputEvent> const&) (/Projects/godot/platform/linuxbsd/x11/display_server_x11.cpp:3593)
[25] DisplayServerX11::_dispatch_input_events(Ref<InputEvent> const&) (/Projects/godot/platform/linuxbsd/x11/display_server_x11.cpp:3565)
[26] Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/Projects/godot/core/input/input.cpp:705)
[27] Input::flush_buffered_events() (/Projects/godot/core/input/input.cpp:964)
[28] DisplayServerX11::process_events() (/Projects/godot/platform/linuxbsd/x11/display_server_x11.cpp:4661)
[29] OS_LinuxBSD::run() (/Projects/godot/platform/linuxbsd/os_linuxbsd.cpp:889)
[30] bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x1fe) [0x55755e8189ae] (/Projects/godot/platform/linuxbsd/godot_linuxbsd.cpp:73)
[31] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f1e1f229d90] (??:0)
[32] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f1e1f229e40] (??:0)
[33] bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x25) [0x55755e8186e5] (??:?)
-- END OF BACKTRACE --

```

### Steps to reproduce

Open the MRP, and click `Add Animation`

![2023-05-19_17-58](https://github.com/godotengine/godot/assets/3624853/68c41e03-eb6c-451e-8f69-9689eb3d6d55)


### Minimal reproduction project

[Godot4Test.zip](https://github.com/godotengine/godot/files/11518538/Godot4Test.zip)

RS::get_singleton()->environment_set_ssil_quality(RS::EnvironmentSSILQuality(int(GLOBAL_GET("rendering/environment/ssil/quality"))), GLOBAL_GET("rendering/environment/ssil/half_size"), GLOBAL_GET("rendering/environment/ssil/adaptive_target"), GLOBAL_GET("rendering/environment/ssil/blur_passes"), GLOBAL_GET("rendering/environment/ssil/fadeout_from"), GLOBAL_GET("rendering/environment/ssil/fadeout_to"));
	RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic);
	RS::EnvironmentSSRRoughnessQuality ssr_roughness_quality = RS::EnvironmentSSRRoughnessQuality(int(GLOBAL_GET("rendering/environment/screen_space_reflection/roughness_quality")));
	RS::get_singleton()->environment_set_ssr_roughness_quality(ssr_roughness_quality);
	RS::SubSurfaceScatteringQuality sss_quality = RS::SubSurfaceScatteringQuality(int(GLOBAL_GET("rendering/environment/subsurface_scattering/subsurface_scattering_quality")));
	RS::get_singleton()->sub_surface_scattering_set_quality(sss_quality);
	float sss_scale = GLOBAL_GET("rendering/environment/subsurface_scattering/subsurface_scattering_scale");
	float sss_depth_scale = GLOBAL_GET("rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale");
	RS::get_singleton()->sub_surface_scattering_set_scale(sss_scale, sss_depth_scale);
	uint32_t directional_shadow_size = GLOBAL_GET("rendering/lights_and_shadows/directional_shadow/size");
	uint32_t directional_shadow_16_bits = GLOBAL_GET("rendering/lights_and_shadows/directional_shadow/16_bits");
	RS::get_singleton()->directional_shadow_atlas_set_size(directional_shadow_size, directional_shadow_16_bits);
	RS::ShadowQuality shadows_quality = RS::ShadowQuality(int(GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/soft_shadow_filter_quality")));
	RS::get_singleton()->positional_soft_shadow_filter_set_quality(shadows_quality);
	RS::ShadowQuality directional_shadow_quality = RS::ShadowQuality(int(GLOBAL_GET("rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality")));
	RS::get_singleton()->directional_soft_shadow_filter_set_quality(directional_shadow_quality);
	float probe_update_speed = GLOBAL_GET("rendering/lightmapping/probe_capture/update_speed");
	RS::get_singleton()->lightmap_set_probe_capture_update_speed(probe_update_speed);
	RS::EnvironmentSDFGIFramesToConverge frames_to_converge = RS::EnvironmentSDFGIFramesToConverge(int(GLOBAL_GET("rendering/global_illumination/sdfgi/frames_to_converge")));
	RS::get_singleton()->environment_set_sdfgi_frames_to_converge(frames_to_converge);
	RS::EnvironmentSDFGIRayCount ray_count = RS::EnvironmentSDFGIRayCount(int(GLOBAL_GET("rendering/global_illumination/sdfgi/probe_ray_count")));
	RS::get_singleton()->environment_set_sdfgi_ray_count(ray_count);
	RS::VoxelGIQuality voxel_gi_quality = RS::VoxelGIQuality(int(GLOBAL_GET("rendering/global_illumination/voxel_gi/quality")));
	RS::get_singleton()->voxel_gi_set_quality(voxel_gi_quality);
	RS::get_singleton()->environment_set_volumetric_fog_volume_size(GLOBAL_GET("rendering/environment/volumetric_fog/volume_size"), GLOBAL_GET("rendering/environment/volumetric_fog/volume_depth"));
	RS::get_singleton()->environment_set_volumetric_fog_filter_active(bool(GLOBAL_GET("rendering/environment/volumetric_fog/use_filter")));
	RS::get_singleton()->canvas_set_shadow_texture_size(GLOBAL_GET("rendering/2d/shadow_atlas/size"));
	bool use_half_res_gi = GLOBAL_GET("rendering/global_illumination/gi/use_half_resolution");
	RS::get_singleton()->gi_set_use_half_resolution(use_half_res_gi);
	bool snap_2d_transforms = GLOBAL_GET("rendering/2d/snap/snap_2d_transforms_to_pixel");