From 747695c39bce7c1c07435ee79d19c1ad081603dc Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Tue, 13 Sep 2022 15:12:42 +1000 Subject: [PATCH] minor fix on threading issue --- Session/Shared/OWSQRCodeScanningViewController.m | 5 ++++- Session/Shared/ScanQRCodeWrapperVC.swift | 8 ++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Session/Shared/OWSQRCodeScanningViewController.m b/Session/Shared/OWSQRCodeScanningViewController.m index bc4778ead..66d235352 100644 --- a/Session/Shared/OWSQRCodeScanningViewController.m +++ b/Session/Shared/OWSQRCodeScanningViewController.m @@ -115,7 +115,10 @@ NS_ASSUME_NONNULL_BEGIN self.capture.layer.frame = self.view.bounds; [self.view.layer addSublayer:self.capture.layer]; [self.view bringSubviewToFront:self.maskingView]; - [self.capture start]; + + dispatch_async(self.captureQueue, ^{ + [self.capture start]; + }); }); }); } else { diff --git a/Session/Shared/ScanQRCodeWrapperVC.swift b/Session/Shared/ScanQRCodeWrapperVC.swift index 4530b0962..a60d9daa7 100644 --- a/Session/Shared/ScanQRCodeWrapperVC.swift +++ b/Session/Shared/ScanQRCodeWrapperVC.swift @@ -67,9 +67,7 @@ final class ScanQRCodeWrapperVC : BaseVC { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) UIDevice.current.ows_setOrientation(.portrait) - DispatchQueue.main.async { [weak self] in - self?.scanQRCodeVC.startCapture() - } + self.scanQRCodeVC.startCapture() } // MARK: Interaction @@ -78,8 +76,6 @@ final class ScanQRCodeWrapperVC : BaseVC { } public func startCapture() { - DispatchQueue.main.async { [weak self] in - self?.scanQRCodeVC.startCapture() - } + self.scanQRCodeVC.startCapture() } }