fix(apple): stop the camera before the engine is destroyed - #1797
Merged
Conversation
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
force-pushed
the
fix/apple-texture-teardown-crash
branch
from
September 9, 2026 18:56
20e08d3 to
37d6c7d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
feat: ...,fix: ...,chore: ...) — this is required by CI and drives the automated changelog/release.README.md) was updated, if applicable.