mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
6.64k stars 983 forks source link

fix: Fix `runAsync` not properly retaining/releasing Frame #2829

Closed mrousavy closed 2 weeks ago

mrousavy commented 2 weeks ago

What

Fixes an issue that actually should've occurred always, but apparently only occurred in runAsync, where the Frame was not properly released.

Before, we manually ref-counted using _refCount, and only if we hit _refCount < 1 we set the _frame to nil.

Now, we moved incrementRefCount and decrementRefCount into Frame itself, which now uses CFRetain and CFRelease.

This seems safer as we use ARC/MRC from NS, but also it now properly executes runAsync without halting.

Changes

Tested on

Related issues

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview May 1, 2024 3:53pm