Fix retain cycle in DiffableTimelineLikeTableViewController

This commit is contained in:
Shadowfacts 2022-06-10 23:41:41 -04:00
parent 7f1577f4a4
commit 68dbbca9b8
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,9 @@ class DiffableTimelineLikeTableViewController<Section: Hashable & CaseIterable,
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
dataSource = UITableViewDiffableDataSource(tableView: tableView, cellProvider: self.cellProvider) dataSource = UITableViewDiffableDataSource(tableView: tableView) { [unowned self] (tableView, indexPath, item) in
self.cellProvider(tableView, indexPath, item)
}
tableView.rowHeight = UITableView.automaticDimension tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 140 tableView.estimatedRowHeight = 140

View File

@ -171,7 +171,6 @@ class ProfileHeaderView: UIView {
} }
private func updateRelationship() { private func updateRelationship() {
// todo: mastodonController should never be nil, but ProfileHeaderViews are getting leaked
guard let mastodonController = mastodonController, guard let mastodonController = mastodonController,
let relationship = mastodonController.persistentContainer.relationship(forAccount: accountID) else { let relationship = mastodonController.persistentContainer.relationship(forAccount: accountID) else {
return return
@ -181,7 +180,6 @@ class ProfileHeaderView: UIView {
} }
@objc private func updateUIForPreferences() { @objc private func updateUIForPreferences() {
// todo: mastodonController should never be nil, but ProfileHeaderViews are getting leaked
guard let mastodonController = mastodonController, guard let mastodonController = mastodonController,
// nil if prefs changed before own account is loaded // nil if prefs changed before own account is loaded
let accountID = accountID, let accountID = accountID,