Fix memory leak

This commit is contained in:
Ali
2020-05-26 22:17:36 +04:00
parent a79141faec
commit 325e028524
3 changed files with 6 additions and 3 deletions

View File

@@ -364,6 +364,8 @@ public enum ChatPresentationInputQueryResult: Equatable {
}
}
public let ChatControllerCount = Atomic<Int32>(value: 0)
public protocol ChatController: ViewController {
var chatLocation: ChatLocation { get }
var canReadHistory: ValuePromise<Bool> { get }

View File

@@ -1065,7 +1065,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
return
}
#if false && DEBUG
#if true && DEBUG
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1.0, execute: { [weak self] in
guard let strongSelf = self else {
return

View File

@@ -140,8 +140,6 @@ private func calculateSlowmodeActiveUntilTimestamp(account: Account, untilTimest
}
}
let ChatControllerCount = Atomic<Int32>(value: 0)
public final class ChatControllerImpl: TelegramBaseController, ChatController, GalleryHiddenMediaTarget, UIDropInteractionDelegate {
private var validLayout: ContainerViewLayout?
@@ -542,6 +540,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
strongSelf.controllerInteraction?.addContact(phoneNumber)
}
}, storeMediaPlaybackState: { [weak self] messageId, timestamp in
guard let strongSelf = self else {
return
}
var storedState: MediaPlaybackStoredState?
if let timestamp = timestamp {
storedState = MediaPlaybackStoredState(timestamp: timestamp, playbackRate: .x1)