Skip to content

Conversation

@rustle
Copy link

@rustle rustle commented Nov 6, 2025

What

This is a revision pass on the work done in #3650

Fix the navigation freeze on React Navigation/Fabric by shutting the camera session down deterministically when the view unmounts.

Changes

Instead of introducing a new shutdown method revise use of configure

  • Cleaning up capture sessions in deinit likely indicates some bookkeeping isn't completing and is likely to obscure rather than fix bugs
  • Adding a completion handler to config adds a lot of complexity we can avoid and replace with a more correct DispatchGroup (the group doesn't notify until any async audio and location work complete)
  • Switch existing DispatchTime usage for dropping redundant config calls to a simple monotonic counter that uses an unfair lock
  • remove didScheduleShutdown as deactivateCameraSession() is safe to call repeatedly

Tested on

iPhone 12 mini running 18.7.1

Related issues

EthanDM and others added 2 commits October 18, 2025 13:38
- Add shutdown method to stop all outputs and release resources
- Schedule shutdown with warning if it takes longer than expected
* Cleaning up capture sessions in deinit likely indicates some bookkeeping isn't completing and is likely to obscure rather than fix bugs
* Adding a completion handler to config adds a lot of complexity we can avoid and replace with a more correct DispatchGroup (the group doesn't notify until any async audio and location work complete)
* Switch existing DispatchTime usage for dropping redundant config calls to a simple monotonic counter that uses an unfair lock
* remove didScheduleShutdown as deactivateCameraSession() is safe to call repeatedly
@vercel
Copy link

vercel bot commented Nov 6, 2025

@rustle is attempting to deploy a commit to the mrousavy's Team Team on Vercel.

A member of the Team first needs to authorize it.

@rustle rustle changed the title Implement more robust config and tear down bookkeeping fix: implement more robust config and tear down bookkeeping Nov 7, 2025
Copy link
Owner

@mrousavy mrousavy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!

Left some comments

@rustle rustle force-pushed the fix/shutdown-freeze-ios26 branch from cd7d8ff to eb07d6a Compare November 11, 2025 21:03
@rustle
Copy link
Author

rustle commented Nov 11, 2025

I've added a comment to explain the manual delegate cleanup and made the work in deinit much smaller and synchronous, but if your preference is still to drop those neither are strictly necessary for this PR to work well.

@rustle rustle requested a review from mrousavy November 13, 2025 01:05
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.

3 participants