Fix instance public timelines crashing
The instance timeline controller needs to store a strong reference to the instance-specific MastodonController since the timeline VC only holds a weak reference, and unlike normal screens, the scene session doesn't hold onto the MastodonController for other instances.
This commit is contained in:
parent
3aa5aa1bc0
commit
c99a724bf3
|
@ -18,6 +18,7 @@ class InstanceTimelineViewController: TimelineTableViewController {
|
||||||
weak var delegate: InstanceTimelineViewControllerDelegate?
|
weak var delegate: InstanceTimelineViewControllerDelegate?
|
||||||
|
|
||||||
let instanceURL: URL
|
let instanceURL: URL
|
||||||
|
let instanceMastodonController: MastodonController
|
||||||
|
|
||||||
var toggleSaveButton: UIBarButtonItem!
|
var toggleSaveButton: UIBarButtonItem!
|
||||||
var toggleSaveButtonTitle: String {
|
var toggleSaveButtonTitle: String {
|
||||||
|
@ -31,9 +32,10 @@ class InstanceTimelineViewController: TimelineTableViewController {
|
||||||
init(for url: URL) {
|
init(for url: URL) {
|
||||||
self.instanceURL = url
|
self.instanceURL = url
|
||||||
|
|
||||||
let mastodonController = MastodonController(instanceURL: url)
|
// the timeline VC only stores a weak reference to it, so we need to store a strong reference to make sure it's not released immediately
|
||||||
|
instanceMastodonController = MastodonController(instanceURL: url)
|
||||||
|
|
||||||
super.init(for: .instance(instanceURL: url), mastodonController: mastodonController)
|
super.init(for: .instance(instanceURL: url), mastodonController: instanceMastodonController)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required init?(coder aDecoder: NSCoder) {
|
||||||
|
|
Loading…
Reference in New Issue