Fix a crash when the ClientProxy is freed. (#3090)

This commit is contained in:
Doug
2024-07-26 11:05:48 +01:00
committed by GitHub
parent 69ae36397b
commit 5a4d21ab7a
@@ -288,11 +288,14 @@ class ClientProxy: ClientProxyProtocol {
restartTask = nil
}
Task {
// Capture the sync service strongly as this method is called on deinit and so the
// existence of self when the Task executes is questionable and would sometimes crash.
Task { [syncService] in
do {
defer {
completion?()
}
try await syncService?.stop()
} catch {
MXLog.error("Failed stopping the sync service with error: \(error)")