Skip to content

[Impeller][iOS] : crashes with EXC_BAD_ACCESS in impeller::Tessellator::TessellateConvex on latest stable version #149646

@Elleo

Description

@Elleo

Steps to reproduce

  1. Using the flutter_map library version 7, create a polygon with a hole
  2. Zoom out a long way from the polygon (this will trigger polygon simplification)

(This is also logged against flutter_map as bug: fleaflet/flutter_map#1903)

Expected results

App should display a zoomed out polygon

Actual results

On iOS the application crashes with EXC_BAD_ACCESS in impeller::Tessellator::TessellateConvex.

This can be reproduced reliably on both physical iOS devices and the iOS simulator.

On other platforms (tested on Windows, MacOS and Android) the crash does not occur.

Code sample

Code sample
          FlutterMap(
            options: const MapOptions(
              initialCenter: LatLng(62.052959, -2.06089),
              initialZoom: 5,
            ),
            children: [
              PolygonLayer(
                polygons: [
                  Polygon(
                      points: [
                        LatLng(62.05508, -2.065901),
                        LatLng(62.054241, -2.060394),
                        LatLng(62.053185, -2.060789),
                        LatLng(62.052959, -2.06089),
                        LatLng(62.052807, -2.061024),
                        LatLng(62.05246, -2.061067),
                        LatLng(62.050884, -2.061689),
                        LatLng(62.050755, -2.061773),
                        LatLng(62.051334, -2.065968),
                        LatLng(62.051392, -2.066128),
                        LatLng(62.051704, -2.066019),
                        LatLng(62.0518, -2.066044),
                        LatLng(62.05191, -2.06622),
                        LatLng(62.051994, -2.066153),
                        LatLng(62.052216, -2.06617),
                        LatLng(62.052147, -2.066901),
                        LatLng(62.05307, -2.066641),
                        LatLng(62.054859, -2.066229),
                        LatLng(62.055008, -2.066119),
                        LatLng(62.05508, -2.065901)
                      ],
                      holePointsList: [
                        [
                          LatLng(62.052925, -2.062824),
                          LatLng(62.052868, -2.062975),
                          LatLng(62.052742, -2.062967),
                          LatLng(62.052635, -2.062899),
                          LatLng(62.05249, -2.062613),
                          LatLng(62.05239, -2.062049),
                          LatLng(62.052383, -2.061845),
                          LatLng(62.052505, -2.061613),
                          LatLng(62.05257, -2.061588),
                          LatLng(62.052643, -2.061579),
                          LatLng(62.052727, -2.061697),
                          LatLng(62.052818, -2.061975),
                          LatLng(62.052948, -2.062588),
                          LatLng(62.052925, -2.062824)
                        ]
                      ],
                      color: Colors.lightBlue.withOpacity(0.5),
                      borderColor: Colors.lightBlue,
                      borderStrokeWidth: 1),
                ],
              ),
            ],
          ),

A full repository is available here: https://github.com/Elleo/impeller_crash

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs

Here's a backtrace from the crash

*   frame #0: 0x000000010359fc9c Flutter`impeller::Tessellator::TessellateConvex(impeller::Path const&, float) + 1092
    frame #1: 0x000000010374cf24 Flutter`impeller::FillPathGeometry::GetPositionBuffer(impeller::ContentContext const&, impeller::Entity const&, impeller::RenderPass&) const + 248
    frame #2: 0x000000010373bbcc Flutter`impeller::SolidColorContents::Render(impeller::ContentContext const&, impeller::Entity const&, impeller::RenderPass&) const + 948
    frame #3: 0x000000010374b770 Flutter`impeller::EntityPass::RenderElement(impeller::Entity&, unsigned long, impeller::InlinePassContext&, int, impeller::ContentContext&, impeller::EntityPassClipStack&, impeller::TPoint<float>) const + 2056
    frame #4: 0x000000010374a074 Flutter`impeller::EntityPass::OnRender(impeller::ContentContext&, impeller::Capture&, impeller::TSize<long long>, impeller::EntityPassTarget&, impeller::TPoint<float>, impeller::TPoint<float>, unsigned int, impeller::EntityPassClipStack&, unsigned long, std::_fl::shared_ptr<impeller::Contents>, std::_fl::optional<impeller::InlinePassContext::RenderPassResult> const&) const + 5392
    frame #5: 0x00000001036e9224 Flutter`impeller::AiksContext::Render(impeller::Picture const&, impeller::RenderTarget&, bool) + 4468
    frame #6: 0x000000010359e344 Flutter`impeller::Renderer::Render(std::_fl::unique_ptr<impeller::Surface, std::_fl::default_delete<impeller::Surface>>, std::_fl::function<bool (impeller::RenderTarget&)> const&) const + 340
    frame #7: 0x00000001038088c4 Flutter`std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLayer(SkISize const&)::$_0>, std::_fl::allocator<fml::internal::CopyableLambda<flutter::GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLayer(SkISize const&)::$_0>>, bool (flutter::SurfaceFrame&, flutter::DlCanvas*)>::operator()(flutter::SurfaceFrame&, flutter::DlCanvas*&&) + 916
    frame #8: 0x00000001036e7458 Flutter`flutter::SurfaceFrame::Submit() + 92
    frame #9: 0x000000010361f4ac Flutter`flutter::Rasterizer::DrawToSurfacesUnsafe(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>>>>) + 1832
    frame #10: 0x0000000103620244 Flutter`std::_fl::__function::__func<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>>>>)::$_1, std::_fl::allocator<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>>>>)::$_1>, void ()>::operator()() + 64
    frame #11: 0x0000000103516d34 Flutter`fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 72
    frame #12: 0x000000010361ebc4 Flutter`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>>>>) + 364
    frame #13: 0x000000010362110c Flutter`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>>&&) + 208
    frame #14: 0x00000001036208f4 Flutter`flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&) + 452
    frame #15: 0x000000010363b2a8 Flutter`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()() + 168
    frame #16: 0x00000001035152f0 Flutter`fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 592
    frame #17: 0x000000010351940c Flutter`fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 32
    frame #18: 0x00000001af6f1bb0 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
    frame #19: 0x00000001af6b2de4 CoreFoundation`__CFRunLoopDoTimer + 884
    frame #20: 0x00000001af65c0fc CoreFoundation`__CFRunLoopDoTimers + 284
    frame #21: 0x00000001af6a55bc CoreFoundation`__CFRunLoopRun + 1940
    frame #22: 0x00000001af6a9d20 CoreFoundation`CFRunLoopRunSpecific + 584
    frame #23: 0x00000001035194f8 Flutter`fml::MessageLoopDarwin::Run() + 88
    frame #24: 0x000000010351859c Flutter`std::_fl::__function::__func<fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0, std::_fl::allocator<fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0>, void ()>::operator()() + 180
    frame #25: 0x00000001035182ac Flutter`fml::ThreadHandle::ThreadHandle(std::_fl::function<void ()>&&)::$_0::__invoke(void*) + 36
    frame #26: 0x00000001fa3dc0ec libsystem_pthread.dylib`_pthread_start + 116

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB)
    • Flutter version 3.22.1 on channel stable at /Users/mike/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (13 days ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (6 available)            
    • Boaternet Mobile (mobile)       • 00008110-0016654C1486801E                • ios            • iOS 17.5.1 21F90
    • Michael’s iPhone (mobile)       • 2367791b546c25282160d84f67106861facefe8f • ios            • iOS 16.7.8 20H343
    • iPhone 15 (mobile)              • 20C1E812-5AA2-414A-A95A-0B6135C0ADA0     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                 • macos                                    • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                    • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                                   • web-javascript • Google Chrome 125.0.6422.114

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions