fix(barcode-scanner): dispatch iOS cancel() cleanup to the main thread (#3393)

Signed-off-by: Alexis Zankowitch <a.zankowitch@reply.de>
This commit is contained in:
zankowitch alexis
2026-05-28 11:46:25 +02:00
committed by GitHub
parent cb863d57c6
commit d8645ab3e5
2 changed files with 11 additions and 4 deletions
@@ -0,0 +1,6 @@
---
"barcode-scanner": patch
"barcode-scanner-js": patch
---
Fixed a crash on iOS when `cancel()` is invoked by running the cancel handler on the main thread.
@@ -337,10 +337,11 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
}
@objc private func cancel(_ invoke: Invoke) {
self.invoke?.reject("cancelled")
destroy()
invoke.resolve()
DispatchQueue.main.async { [self] in
self.invoke?.reject("cancelled")
self.destroy()
invoke.resolve()
}
}
}