Repository: flutter
Issue: Crashed: SingleEngine-Menu.7.raster
Labels: c: crash,platform-ios,engine,P3,needs repro info,team-engine,triaged-engine

### Steps to reproduce

Nothing specific,

some data on the devices impacted:
> Model: iPhone 13 Pro Max
> Orientation: Portrait
> RAM free: 66.05 MB

> Model:iPhone 15 Pro Max
> Orientation:Portrait
> RAM free: 123.36 MB

> Model:iPhone 14 Pro
> Orientation:Portrait
> RAM free: 200.66 MB

### Expected results

No Crash

### Actual results

The crash is happening randomly.

### Code sample

There is nothing to share here; check the stack trace.

### Logs

<details open><summary>Logs</summary>

```console
Crashed: SingleEngine-Menu.7.raster
0  Flutter                        0x5c87a4 flutter::GPUSurfaceMetalSkia::AllowsDrawingWhenGpuDisabled() const + 268 (gpu_surface_metal_skia.mm:268)
1  Flutter                        0x3f29e8 flutter::Rasterizer::DrawToSurfaces(flutter::FrameTimingsRecorder&, std::_fl::vector<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>, std::_fl::allocator<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>>>) + 540 (rasterizer.cc:540)
2  Flutter                        0x3f46ec std::_fl::__function::__func<flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&)::$_0, std::_fl::allocator<flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&)::$_0>, void (std::_fl::unique_ptr<flutter::FrameItem, std::_fl::default_delete<flutter::FrameItem>>)>::operator()(std::_fl::unique_ptr<flutter::FrameItem, std::_fl::default_delete<flutter::FrameItem>>&&) + 423 (vector:423)
3  Flutter                        0x3f3f38 flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&) + 259 (unique_ptr.h:259)
4  Flutter                        0x40c3ec std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::Shell::OnAnimatorDraw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>>)::$_0>, std::_fl::allocator<fml::internal::CopyableLambda<flutter::Shell::OnAnimatorDraw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>>)::$_0>>, void ()>::operator()() + 1260 (shell.cc:1260)
5  Flutter                        0x2e8f08 fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 128 (message_loop_impl.cc:128)
6  Flutter                        0x2ec6bc fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 86 (message_loop_darwin.mm:86)
7  CoreFoundation                 0xb7a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
8  CoreFoundation                 0xb76d0 __CFRunLoopDoTimer + 1004
9  CoreFoundation                 0xb722c __CFRunLoopDoTimers + 288
10 CoreFoundation                 0x53888 __CFRunLoopRun + 1856
11 CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
12 Flutter                        0x2ec7a8 fml::MessageLoopDarwin::Run() + 52 (message_loop_darwin.mm:52)
13 Flutter                        0x2ebe20 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0>>(void*) + 94 (message_loop_impl.cc:94)
14 libsystem_pthread.dylib        0x606c _pthread_start + 136
15 libsystem_pthread.dylib        0x10d8 thread_start + 8
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.19.4, on macOS 14.0 23A344 darwin-arm64, locale en-GB)
    • Flutter version 3.19.4 on channel stable at /Users/ahmed.henawey/fvm/versions/3.19.4
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68bfaea224 (3 months ago), 2024-03-20 15:36:31 -0700
    • Engine revision a5c24f538d
    • Dart version 3.3.2
    • DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/ahmed.henawey/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 77.3.1
    • Dart plugin version 233.13763.5

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (3 available)
    • Ahmed Henawey’s iPhone (mobile) • 00008110-001460AE2691801E • ios            • iOS 17.5.1 21F90
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.0 23A344
      darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome
      125.0.6422.142
    ! Error: Browsing on the local area network for Phoneshwaran. Ensure the device is unlocked and attached
      with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for iPad. Ensure the device is unlocked and attached with a
      cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for iOS team’s iPhone. Ensure the device is unlocked and
      attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.
```

</details>