fix(barcode-scanner): dispatch iOS cancel() cleanup to the main thread#3393
fix(barcode-scanner): dispatch iOS cancel() cleanup to the main thread#3393AlexisZankowitch wants to merge 2 commits intotauri-apps:v2from
Conversation
Signed-off-by: Alexis Zankowitch <a.zankowitch@reply.de>
Methodology used to diagnose and "fix" the issue
From my crash report: Diagnosis from Claude Opus 4.7Looking at The other commands in the same file ( |
Summary
Wraps the body of
BarcodeScannerPlugin.cancel(_:)on iOS inDispatchQueue.main.asyncso the UIKit teardown runs on the main thread.Context — please review carefully⚠️
I'm not an iOS developer. I hit this crash while building a Tauri iOS app and worked through the diagnosis and fix with Claude Opus 4.7. I want to be upfront about my limited native iOS experience so a maintainer familiar with the plugin internals can validate the approach before merging. This code fixed the issue I was facing, so I wanted to share it here.
The fix the agent proposed
Wrap the body of
cancel(_:)inDispatchQueue.main.async, mirroring the pattern already used byscan()andopenAppSettings()⬇️ Methodology explained in my comment below ⬇️
How I validated the fix
Potential related issues
Issues that could be related, please let me know if I should mention them in the PR title.
cancelis called while no longer reading #3081 (however this one has been already closed)Final notes
I reviewed the best I could what the agent proposed and ran some tests and it seems to be working fine for me. That's why I wanted to propose the fix to you guys as well. But I'm perfectly fine if you guys want to take those changes and push it from another PR if you think it's more appropriate. Hopefully I didn't fail your AI policy. If so I apologize and can delete my PR 😅