### Godot version

4.0.dev (c309de53997feff3286295fb2d71657f112a15db)

### System information

Linux, Nvidia, Vulkan

### Issue description

Editor segfaults when certain conditions are met when using the AnimationPlayer editor.

### Steps to reproduce

1. Create multiple animations, saved into a animation collection
2. Open an existing animation, then make a new empty animation
3. Change from seconds to fps, or add a new property to animate ()
4. Editor crashes

NOTE: It is slightly random and I have not found a perfect repro

### Minimal reproduction project

N/A (TBD?)
}
				}
				menu->reset_size();
				Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
				menu->set_position(popup_pos);
				menu->popup();
				accept_event();
			}
			if (loop_wrap_rect.has_point(pos)) {
				if (!menu) {
					menu = memnew(PopupMenu);
					add_child(menu);
					menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
				}
				menu->clear();
				menu->add_icon_item(get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
				menu->add_icon_item(get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
				menu->reset_size();
				Vector2 popup_pos = get_screen_position() + loop_wrap_rect.position + Vector2(0, loop_wrap_rect.size.height);
				menu->set_position(popup_pos);
				menu->popup();
				accept_event();
			}
			if (remove_rect.has_point(pos)) {
				emit_signal(SNAME("remove_request"), track);
				accept_event();
				return;
			}
		}