Fix crash when switching accounts
This commit is contained in:
parent
dc1ea1bed9
commit
b95819cada
|
@ -42,10 +42,12 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
|||
}
|
||||
|
||||
deinit {
|
||||
guard let persistentContainer = mastodonController?.persistentContainer else { return }
|
||||
guard let persistentContainer = mastodonController?.persistentContainer,
|
||||
let dataSource = dataSource else { return }
|
||||
// decrement reference counts of any statuses we still have
|
||||
// if the app is currently being quit, this will not affect the persisted data because
|
||||
// the persistent container would already have been saved in SceneDelegate.sceneDidEnterBackground(_:)
|
||||
// todo: remove the whole reference count system
|
||||
for case let .status(id: id, state: _) in dataSource.snapshot().itemIdentifiers {
|
||||
persistentContainer.status(for: id)?.decrementReferenceCount()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue