Skip to content

[Impeller] Missing capability check for decoding image to wide pixel format / crash on iPad Air2. #164794

@Stainie

Description

@Stainie

Steps to reproduce

  1. Create a new Flutter project
  2. Create a scrollable page with carousels (scrollable content-like horizontal lists with network images)
  3. Build the app (do not run it directly from the code)
  4. Observe the crash that happens while the images load

Expected results

As in the previous Flutter versions, the content should load without crashing.

Actual results

The app freezes while loading the network images and shortly after crashes.

Code sample

Code sample

Here is the relevant Media widget. Create a page with Horizontal ListViews containing this Widget as items to reproduce the issue.

return Container(
        height: height,
        child: Stack(children: [
          borders
              ? ClipRRect(
                  borderRadius: BorderRadius.circular(12.0),
                  child: _buildMedia(context, height, backgroundImageUrl))
              : _buildMedia(context, height, backgroundImageUrl),
          if (showProviders)
            Positioned(
              bottom: -1,
              left: 0,
              right: 0,
              child: Container(
                height: 24,
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    begin: Alignment.bottomCenter,
                    end: Alignment.topCenter,
                    colors: [
                      Colors.blueGrey,
                      Colors.blueGrey.withOpacity(0.25),
                      Colors.blueGrey.withOpacity(0.0),
                    ],
                  ),
                ),
              ),
            ),
        ]));

Widget _buildMedia(BuildContext context, double height, String backgroundImageUrl) {
    return SizedBox(
        width: 200,
        height: 150,
        child: Container(
          child: Stack(
            children: [
              InternetImage(
                  imageUrl: backgroundImageUrl, width: width, height: height),
              Align(
                  alignment: Alignment.bottomCenter,
                  child: Container(
                    height: 60,
                    decoration: BoxDecoration(
                      gradient: LinearGradient(
                        begin: Alignment.bottomCenter,
                        end: Alignment.topCenter,
                        colors: [
                          Colors.black.withOpacity(0.5),
                          Colors.transparent,
                        ],
                      ),
                    ),
                  )),
              Align(
                  alignment: Alignment.bottomLeft,
                  child: Row(
                    children: [
                      Expanded(
                          child: Stack(children: [
                        SizedBox(
                            height: height,
                            child: Container(color: Colors.white24)),
                        LayoutBuilder(builder:
                            (BuildContext context, BoxConstraints constraints) {
                          return SizedBox(
                              width: max(0, (constraints.maxWidth * 100)),
                              height: height,
                              child: GradientProgressIndicator(
                                gradient: LinearGradient(
                                  colors: [
                                    Colors.green,
                                    Colors.green.withOpacity(0.5),
                                  ],
                                ),
                                value: 1.0,
                              ));
                        }),
                      ]))
                    ],
                  )),
              Align(
                alignment: Alignment.center,
                child: Container(
                  width: 40,
                  height: 40,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: Colors.black.withOpacity(0.7),
                  ),
                  child: Padding(
                    padding: const EdgeInsets.all(5),
                    child: SvgPicture.asset('assets/images/svg/ui-play.svg',
                        colorFilter: const ColorFilter.mode(
                            Colors.white, BlendMode.srcIn)),
                  ),
                ),
              ),
              Align(
                alignment: Alignment.bottomCenter,
                child: Container(
                  margin: const EdgeInsets.only(bottom: 10),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    border: Border.all(color: Colors.green),
                    borderRadius: BorderRadius.circular(8.0),
                  ),
                  child: Padding(
                      padding: const EdgeInsets.symmetric(
                          vertical: 4, horizontal: 16),
                      child: Text(
                        "Coming soon",
                        style: TextStyle(
                            color: Colors.green,
                            height: 1.0,
                            fontSize: 12,
                            fontWeight: FontWeight.w700),
                      )),
                ),
              ),
            ],
          ),
        ));
  }

Screenshots or Video

Screenshots / Video demonstration

Image

Logs

Logs
impeller::BlitPassMTL::ResizeTexture(std::_fl::shared_ptr<impeller::Texture> const&, std::_fl::shared_ptr<impeller::Texture> const&)

Crashed: io.worker.2
SIGABRT ABORT 0x00000001bcf22bbc

          Crashed: io.worker.2
0  libsystem_kernel.dylib         0x6bbc __pthread_kill + 8
1  libsystem_pthread.dylib        0xd854 pthread_kill + 208
2  libsystem_c.dylib              0x1f6a4 abort + 124
3  libsystem_c.dylib              0x736d8 err + 266
4  Metal                          0xcc498 bool MTLGetEnvCase<MTLErrorModeType>(char const*, MTLErrorModeType&, std::__1::vector<std::__1::pair<char const*, MTLErrorModeType>, std::__1::allocator<std::__1::pair<char const*, MTLErrorModeType> > > const&) (.cold.1) + 50
5  Metal                          0xb8c94 MTLReportFailure + 452
6  MPSImage                       0x3724 (Missing UUID 9f483b0ecaef3d33bed1d1329aa10690)
7  Flutter                        0x506104 impeller::BlitPassMTL::ResizeTexture(std::_fl::shared_ptr<impeller::Texture> const&, std::_fl::shared_ptr<impeller::Texture> const&) + 132 (blit_pass_mtl.mm:132)
8  Flutter                        0x58b438 flutter::ImageDecoderImpeller::UnsafeUploadTextureToPrivate(std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::optional<SkImageInfo> const&) + 372 (image_decoder_impeller.cc:372)
9  Flutter                        0x58c01c std::_fl::__function::__func<flutter::ImageDecoderImpeller::UploadTextureToPrivate(std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)>, std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::shared_ptr<SkBitmap> const&, std::_fl::optional<SkImageInfo> const&, std::_fl::shared_ptr<fml::SyncSwitch> const&)::$_0, std::_fl::allocator<flutter::ImageDecoderImpeller::UploadTextureToPrivate(std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)>, std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::shared_ptr<SkBitmap> const&, std::_fl::optional<SkImageInfo> const&, std::_fl::shared_ptr<fml::SyncSwitch> const&)::$_0>, void ()>::operator()() + 425 (image_decoder_impeller.cc:425)
10 Flutter                        0x90a3c fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 199 (shared_mutex:199)
11 Flutter                        0x58a054 flutter::ImageDecoderImpeller::UploadTextureToPrivate(std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)>, std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::shared_ptr<SkBitmap> const&, std::_fl::optional<SkImageInfo> const&, std::_fl::shared_ptr<fml::SyncSwitch> const&) + 470 (function.h:470)
12 Flutter                        0x589594 std::_fl::__function::__func<flutter::ImageDecoderImpeller::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, std::_fl::allocator<flutter::ImageDecoderImpeller::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>, void ()>::operator()() + 470 (function.h:470)
13 Flutter                        0x92678 fml::ConcurrentMessageLoopDarwin::ExecuteTask(std::_fl::function<void ()> const&) + 18 (concurrent_message_loop_factory.mm:18)
14 Flutter                        0x8bb04 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::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 1372 (vector:1372)
15 libsystem_pthread.dylib        0x3348 _pthread_start + 116
16 libsystem_pthread.dylib        0x1948 thread_start + 8

/Library/Caches/com.apple.xbs/Sources/MetalImage/MPSImage/Filters/MPSImageUnaryKernel.mm:352: failed assertion `Destination 0x118086ba0 texture format 554 must be writable. '

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.1, on macOS 15.3.1 24D70 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[!] Xcode - develop for iOS and macOS (Xcode 16.2)
    ! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.98.0)
[✓] Connected device (5 available)            
[✓] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions