Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goalvc was crashing when refreshing its ui for an unavailable goal #596

Closed

Conversation

krugerk
Copy link
Contributor

@krugerk krugerk commented Jan 1, 2025

Summary

Despite the changes in #591, a crash was still observed.

For UI changes including screenshots of before and after is great.

Validation

added logging to validate vc being deallocated when expected
in simulator, navigated gallery to goal and back and forth again

#590

@krugerk krugerk requested a review from a team as a code owner January 1, 2025 00:40
@krugerk krugerk requested review from theospears and removed request for a team January 1, 2025 00:40
self.datapointTableController.datapoints = goal.recentData.sorted(by: {$0.updatedAt < $1.updatedAt})
@MainActor func updateInterfaceToMatchGoal() {
self.datapointTableController?.hhmmformat = goal.hhmmFormat
self.datapointTableController?.datapoints = goal.recentData.sorted(by: {$0.updatedAt < $1.updatedAt})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.datapointTableController?.datapoints = goal.recentData.sorted(by: {$0.updatedAt < $1.updatedAt})
self.datapointTableController?.datapoints = goal.recentData.sorted(using: SortDescriptor(\.updatedAt))

@@ -312,6 +315,9 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl
super.viewDidDisappear(animated)
lastUpdatedTimer?.invalidate()
lastUpdatedTimer = nil
datapointTableController?.delegate = nil
datapointTableController = nil
NotificationCenter.default.removeObserver(self)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NotificationCenter.default.removeObserver(self)

docs point out that modern iOS versions take care of this automatically

@theospears
Copy link
Collaborator

Are you able to reliably repro the crash? If so, what does the memory debugger show at the time? I'm very open to the idea this patch is correct, but would like to understand why.

@krugerk
Copy link
Contributor Author

krugerk commented Jan 14, 2025

Are you able to reliably repro the crash? If so, what does the memory debugger show at the time? I'm very open to the idea this patch is correct, but would like to understand why.

no, apparently not.

@krugerk krugerk closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants