Skip to content

fix(apple): stop the camera before the engine is destroyed - #1797

Merged
juliansteenbakker merged 1 commit into
developfrom
fix/apple-texture-teardown-crash
Sep 9, 2026
Merged

fix(apple): stop the camera before the engine is destroyed#1797
juliansteenbakker merged 1 commit into
developfrom
fix/apple-texture-teardown-crash

Conversation

@juliansteenbakker

Copy link
Copy Markdown
Owner

captureOutput ran on sampleBufferQueue and called textureFrameAvailable straight from it, so a frame in flight during termination could reach the engine after destroyContext had reset its shell, crashing with EXC_BAD_ACCESS. The relay's weak parent does not help here: the FlutterEngine object stays alive, only the shell behind it is gone.

A follow up of #1769

Checklist

  • The PR title follows Conventional Commits (e.g. feat: ..., fix: ..., chore: ...) — this is required by CI and drives the automated changelog/release.
  • (Optional) Each individual commit also follows Conventional Commits — if so, we'll merge with a real merge commit to preserve your full history; otherwise we'll squash the PR into one commit.
  • Tests were added or updated, if applicable.
  • Documentation (README.md) was updated, if applicable.

captureOutput ran on sampleBufferQueue and called textureFrameAvailable
straight from it, so a frame in flight during termination could reach the
engine after destroyContext had reset its shell, crashing with
EXC_BAD_ACCESS. The relay's weak parent does not help here: the
FlutterEngine object stays alive, only the shell behind it is gone.

Stop the capture session on willTerminate, and hop the notification to the
main queue with at most one block in flight.

Co-Authored-By: Truong Luu <truonglv@outlook.com>
@juliansteenbakker
juliansteenbakker force-pushed the fix/apple-texture-teardown-crash branch from 20e08d3 to 37d6c7d Compare September 9, 2026 18:56
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.85%. Comparing base (997502a) to head (37d6c7d).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1797   +/-   ##
========================================
  Coverage    62.85%   62.85%           
========================================
  Files           48       48           
  Lines         1233     1233           
========================================
  Hits           775      775           
  Misses         458      458           
Flag Coverage Δ
unittests 62.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@juliansteenbakker
juliansteenbakker merged commit 9178d27 into develop Sep 9, 2026
14 checks passed
@juliansteenbakker
juliansteenbakker deleted the fix/apple-texture-teardown-crash branch September 9, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants