From 646e8b3a555e37330ef8dc338b7098b179eaa452 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 23 Mar 2023 12:50:40 +0200 Subject: [PATCH] Fix uniffi crash: delay session verification controller delegate setting to when verification is requested --- .../SessionVerificationControllerProxy.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift b/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift index db1fa8df4..589b17a83 100644 --- a/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift +++ b/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift @@ -57,7 +57,6 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt init(sessionVerificationController: SessionVerificationController) { self.sessionVerificationController = sessionVerificationController - sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self)) } deinit { @@ -71,7 +70,9 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt } func requestVerification() async -> Result { - await Task.dispatch(on: .global()) { + sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self)) + + return await Task.dispatch(on: .global()) { do { try self.sessionVerificationController.requestVerification() return .success(())