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 authored and GitHub committed 2026-05-28 11:46:25 +02:00
1 parent cb863d57c6
commit d8645ab3e5
2 files changed
+11 -4

No files matched your search

@@ -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) { @objc private func cancel(_ invoke: Invoke) {
self.invoke?.reject("cancelled") DispatchQueue.main.async { [self] in
self.invoke?.reject("cancelled")
destroy() self.destroy()
invoke.resolve() invoke.resolve()
}
} }
} }