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

App crashes when updating obsolete formulae #22

Closed
cweirup opened this issue Feb 27, 2023 · 4 comments
Closed

App crashes when updating obsolete formulae #22

cweirup opened this issue Feb 27, 2023 · 4 comments
Assignees
Labels
Bug Something isn't working

Comments

@cweirup
Copy link

cweirup commented Feb 27, 2023

When I clicked the "Update" button in the Outdated items section of the main screen, the app crashed and sent me back to Xcode. I've attached the output from the Console.

To recreate:

  • You will need at least 1 outdated package.
  • Build and launch app.
  • Click the "Update" button under the outdated package section in Homebrew Status. The issue happens if "Outdated packages" is expanded or not.

The error in the Console is:

SwiftUI/EnvironmentObject.swift:82: Fatal error: No ObservableObject of type UpdateProgressTracker found. A View.environmentObject(_:) for UpdateProgressTracker may be missing as an ancestor of this view.
2023-02-26 22:14:22.612178-0500 Cork[8331:11138509] SwiftUI/EnvironmentObject.swift:82: Fatal error: No ObservableObject of type UpdateProgressTracker found. A View.environmentObject(_:) for UpdateProgressTracker may be missing as an ancestor of this view.

Based on a bit of playing around, I believe you may need to add the Environment Object to the ContentView in CorkApp:

            ContentView()
                .environmentObject(appState)
                .environmentObject(brewData)
                .environmentObject(availableTaps)
                .environmentObject(selectedPackageInfo)
                .environmentObject(updateProgressTracker)
                .onAppear
                {
                    NSWindow.allowsAutomaticWindowTabbing = false
                }

I've also included screenshots of the screen I've referenced and what I see in Xcode. Let me know if you need more info.

Issue - App Crashes Updating Formulae - Console Output.txt

Homebrew Status Screen with Outdated Formulae

Outdated Formulae Crash in Xcode

@buresdv buresdv self-assigned this Feb 27, 2023
@buresdv buresdv added the Bug Something isn't working label Feb 27, 2023
@buresdv
Copy link
Owner

buresdv commented Feb 27, 2023

Your suggestion was right. Try the newest code from the main branch, I tried to update my packages and it worked with no crash.

@buresdv
Copy link
Owner

buresdv commented Feb 27, 2023

There's still one problem that I will have to fix: when you update the packages, the UI doesn't update. I logged it as a bug.

@cweirup
Copy link
Author

cweirup commented Feb 28, 2023

I've confirmed that the update fixed the crashing problem. Thanks!

@buresdv
Copy link
Owner

buresdv commented Feb 28, 2023

Great, I'll close the issue.

@buresdv buresdv closed this as completed Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants