Closed Voxar closed 5 days ago
Guten Tag, Hans here.
Thanks for your detailed report, but it looks like you need to gather ze logs from Xcode or adb logcat to help mrousavy understand ze problem better. Also, make sure to try reproducing ze issue in the VisionCamera Example app, as this is essential to get it resolved.
If you want quicker responses, consider supporting ze project by sponsoring mrousavy. Cheers! 🍻
Note: If you think I made a mistake by closing this issue, please ping
@mrousavy
to take a look.
I did not manage to run the example. I get errors following the readme
⋊> ~/W/T/r/r/package on main ⨯ bun bootstrap
$ bun && cd example && bun && bun pods
Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.1.34+5e5e7c60f)
Usage: bun <command> [...flags] [...args]
Commands:
run ./my-script.ts Execute a file with Bun
lint Run a package.json script
test Run unit tests with Bun
x nuxi Execute a package binary (CLI), installing if needed (bunx)
repl Start a REPL session with Bun
exec Run a shell script directly with Bun
install Install dependencies for a package.json (bun i)
add elysia Add a dependency to package.json (bun a)
remove moment Remove a dependency from package.json (bun rm)
update @shumai/shumai Update outdated dependencies
outdated Display latest versions of outdated dependencies
link [<package>] Register or link a local npm package
unlink Unregister a local npm package
publish Publish a package to the npm registry
patch <pkg> Prepare a package for patching
pm <subcommand> Additional package management utilities
build ./a.ts ./b.jsx Bundle TypeScript & JavaScript into a single file
init Start an empty Bun project from a blank template
create next-app Create a new project from a template (bun c)
upgrade Upgrade to latest version of Bun.
<command> --help Print help text for command.
Learn more about Bun: https://bun.sh/docs
Join our Discord community: https://bun.sh/discord
/bin/bash: line 0: cd: example: No such file or directory
error: script "bootstrap" exited with code 1
Hello @mrousavy. I do think the bot made a mistake closing this as I did attach an xcode log and I could not run the example at all by following the current instructions.
Turns out the issues are only surfaced when I'm using the Continuity Camera. I guess that is a bit narrow case for you and others to bother with. I will try anyways as development is so much nicer when you can the app you work on directly on the Mac.
Any ideas on the threading issue would be welcome as I have no clue about what React Natives thread handling looks like. I'll start with trying to just dispatch all MotionManager calls to the same queue.
Here's a demo app: https://github.com/Voxar/react-native-vision-camera-continuity-camera-crash
What's happening?
After updating from 3.9.1 to 4.6.1 I get a crash when opening a view with a <Camera ...> for the second time.
When the OrientationManager calls stopDeviceOrientationListener the callback block previously sent to motionManager.startAccelerometerUpdates is released which then frees an OrientationManager instance, presumably the one from the previous session that is still held on to by the block.
The block is retained until the motionManager is stopped. A
[weak self]
at https://github.com/mrousavy/react-native-vision-camera/blob/143ec9ff578e3b9bd6b86483ee490fc217d975eb/package/ios/Core/OrientationManager.swift#L164 seems to solve the crash.However while testing the above quick fix by moving in and out of my react native camera view somewhat rapidly I also get this crash over several user-interactive threads all on objc_release, and one CoreMotion.MotionThread objc_MsgSend,
Now I am running a "My Mac (Designed for iPhone)" target with Continuity Camera from an iPhone with 18.2 beta today, so threading issues could be related to any of that. I'll give this a few more hours tomorrow to try the example and a fresh minimal case sample on the phone, and perhaps get a PR away with the block-retained self as well if I can determine that the threading issues are not related to that.
Reproduceable Code
Relevant log output
Camera Device
Device
iPhone 13 Pro iOS 18.2
VisionCamera Version
4.6.1
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (⚠️ your issue might get ignored & closed if you don't try this)
Additional information