From b2307dffdd54449e4cb516c3af87a3fecf98dcd0 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 10 Feb 2023 22:18:36 +0400 Subject: [PATCH] Keep call instance in memory until it's completed --- submodules/TelegramVoip/Sources/OngoingCallContext.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/submodules/TelegramVoip/Sources/OngoingCallContext.swift b/submodules/TelegramVoip/Sources/OngoingCallContext.swift index 67f3f2dfdf..ddd3f5e954 100644 --- a/submodules/TelegramVoip/Sources/OngoingCallContext.swift +++ b/submodules/TelegramVoip/Sources/OngoingCallContext.swift @@ -1123,7 +1123,8 @@ public final class OngoingCallContext { } let tempStatsLogPath = self.tempStatsLogFile.path - self.withContextThenDeallocate { context in + let queue = self.queue + self.withContext { context in context.nativeStop { debugLog, bytesSentWifi, bytesReceivedWifi, bytesSentMobile, bytesReceivedMobile in let delta = NetworkUsageStatsConnectionsEntry( cellular: NetworkUsageStatsDirectionsEntry( @@ -1154,6 +1155,10 @@ public final class OngoingCallContext { } }) } + + queue.async { + let _ = context.nativeGetDerivedState() + } } } }