diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index a34f8d09..6d43c28e 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -100,16 +100,16 @@ class BaseStatusTableViewCell: UITableViewCell { open func createObserversIfNecessary() { if statusUpdater == nil { statusUpdater = mastodonController.cache.statusSubject - .filter { $0.id == self.statusID } + .filter { [unowned self] in $0.id == self.statusID } .receive(on: DispatchQueue.main) - .sink(receiveValue: updateStatusState(status:)) + .sink { [unowned self] in self.updateStatusState(status: $0) } } if accountUpdater == nil { accountUpdater = mastodonController.cache.accountSubject - .filter { $0.id == self.accountID } + .filter { [unowned self] in $0.id == self.accountID } .receive(on: DispatchQueue.main) - .sink(receiveValue: updateUI(account:)) + .sink { [unowned self] in self.updateUI(account: $0) } } } diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index 6e115f6c..6ffa7b64 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -49,9 +49,9 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { if rebloggerAccountUpdater == nil { rebloggerAccountUpdater = mastodonController.cache.accountSubject - .filter { $0.id == self.rebloggerID } + .filter { [unowned self] in $0.id == self.rebloggerID } .receive(on: DispatchQueue.main) - .sink(receiveValue: updateRebloggerLabel(reblogger:)) + .sink { [unowned self] in self.updateRebloggerLabel(reblogger: $0) } } } @@ -95,6 +95,7 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { } func updateTimestamp() { + guard superview != nil else { return } guard let status = mastodonController.cache.status(for: statusID) else { fatalError("Missing cached status \(statusID!)") } timestampLabel.text = status.createdAt.timeAgoString()