mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-12 22:47:08 +02:00
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:
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user