mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Fix for a memory leak (#3143)
This commit is contained in:
@@ -440,16 +440,14 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
Task { [weak self] in
|
Task { [weak self] in
|
||||||
guard let self else {
|
// Don't guard let self here, otherwise the for await will strongify the self reference creating a strong reference cycle.
|
||||||
return
|
|
||||||
}
|
|
||||||
// If the subscription has sent a value before the Task has started it might be lost, so before entering the loop we always do an update.
|
// If the subscription has sent a value before the Task has started it might be lost, so before entering the loop we always do an update.
|
||||||
await updatePinnedEventIDs()
|
await self?.updatePinnedEventIDs()
|
||||||
for await _ in roomInfoSubscription.receive(on: DispatchQueue.main).values {
|
for await _ in roomInfoSubscription.receive(on: DispatchQueue.main).values {
|
||||||
guard !Task.isCancelled else {
|
guard !Task.isCancelled else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await updatePinnedEventIDs()
|
await self?.updatePinnedEventIDs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|||||||
Reference in New Issue
Block a user