-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: App crashes when Camera using scanner is closed #2213
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Interesting, maybe the true fix can be in Difference? I'll take a look soon, thanks for your PR! |
If |
Yea, the problem with the Main Thread approach is that this queues the stop to be run on the Main Thread. The method So assuming Android deletes the SurfaceView now, and we still try to draw a Frame to it BEFORE the We need to be aware that this race condition can exist, so I think a true fix is to provide a single source of truth for the Difference and delete the Preview accordingly, I will take a look at that soon! I think running this fix in your app for now is perfectly fine though, that's like a 0.001% chance of crashing. |
@mrousavy thank you in advance! Any update on this? |
Are there updates regarding this PR? |
Facing the same issue. |
same problem here |
I think I'm having this same problem. I'm scanning QR codes on an app. And sometimes after scanning the app will crash with a seg fault. I've patched these changes into my project and can confirm its stopped crashing |
I got the same issue, looking forward to the merge of this PR. Thanks for your good work! |
I tried the above fix but getting: Is there an updated fix for this? Thanks! |
This is fixed in V4 |
What
The App crashes when the Camera component with the code scanner after returning results is closed and unmounted.
Changes
The PR changes the destroyPreviewOutputSync and makes it run within the main dispatcher.
Tested on
OPPO A36, Android 11
Related issues
Note
I'm 100% sure this is the correct solution, but it works for me and others. I have not fully tested other features except for code scanner and photo capture which satisfy my needs, so I have not further debugged either.
What's more, I have another solution. This function aims to let
configure
compare out a difference, and forcingdiff
to betrue
can also resolve this issue. So that,Of course, this is a more inappropriate solution, but just to give a clue of what's going on here.
Let me know if you need another PR or more information