Repository: flutter
Issue: [IOS] SkData::PrivateNewWithCopy(void const*, unsigned long) | Skia backend
Labels: c: crash,platform-ios,engine,a: production,P3,needs repro info,team-engine,triaged-engine

### Steps to reproduce

Nothing specific,
my hypothesis is related to old devices (iPhone 7, 8, X, XR) with low RAM.
examples:

>Model: iPhone 8 Plus
>Orientation: Portrait
>RAM free: 79.86 MB

> Model:iPhone X
> Orientation:Portrait
> RAM free: 56.56 MB

> Model:iPhone 8 Plus
> Orientation:Portrait
> RAM free: 33.75 MB

> Model: iPhone XR
> Orientation: Portrait
> RAM free: 43.08 MB

> Model: iPhone 8 Plus
> Orientation: Portrait
> RAM free: 86.31 MB

> Model:iPhone X
> Orientation:Portrait
> RAM free: 33.84 MB

> Model: iPhone 8 Plus
> Orientation: Portrait
> RAM free: 30.22 MB

> Model:iPhone X
> Orientation:Portrait
> RAM free: 34.91 MB



### Expected results

No Crash

### Actual results

The crash is happening randomly.

### Code sample

There is nothing to share here; check the stack trace.

### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
Crashed: SingleEngine-deeplinkMain.8.io
0  Flutter                        0x97e7c SkData::PrivateNewWithCopy(void const*, unsigned long) + 910 (atomic:910)
1  Flutter                        0xfd694 MakeRasterCopyPriv(SkPixmap const&, unsigned int) + 145 (SkPixmap.h:145)
2  Flutter                        0x21d0c0 SkImages::CrossContextTextureFromPixmap(GrDirectContext*, SkPixmap const&, bool, bool) + 83 (SkImage_RasterFactories.cpp:83)
3  Flutter                        0x55aef8 std::_fl::__function::__func<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager> const&, fml::tracing::TraceFlow const&)::$_1, std::_fl::allocator<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager> const&, fml::tracing::TraceFlow const&)::$_1>, void ()>::operator()() + 303 (SkRefCnt.h:303)
4  Flutter                        0x2ea89c fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 29 (shared_mutex.h:29)
5  Flutter                        0x55a948 std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::ImageDecoderSkia::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)> const&)::$_1::operator()()::'lambda'()>, std::_fl::allocator<fml::internal::CopyableLambda<flutter::ImageDecoderSkia::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)> const&)::$_1::operator()()::'lambda'()>>, void ()>::operator()() + 470 (function.h:470)
6  Flutter                        0x2e8f08 fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 128 (message_loop_impl.cc:128)
7  Flutter                        0x2ec6bc fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 86 (message_loop_darwin.mm:86)
8  CoreFoundation                 0xc1bb0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
9  CoreFoundation                 0x82de4 __CFRunLoopDoTimer + 884
10 CoreFoundation                 0x2c0fc __CFRunLoopDoTimers + 284
11 CoreFoundation                 0x755bc __CFRunLoopRun + 1940
12 CoreFoundation                 0x79d20 CFRunLoopRunSpecific + 584
13 Flutter                        0x2ec7a8 fml::MessageLoopDarwin::Run() + 52 (message_loop_darwin.mm:52)
14 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)
15 libsystem_pthread.dylib        0x30ec _pthread_start + 116
16 libsystem_pthread.dylib        0x172c 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>