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

Clicking the share button causes UTM to crash #3208

Closed
longwa opened this issue Oct 26, 2021 · 11 comments
Closed

Clicking the share button causes UTM to crash #3208

longwa opened this issue Oct 26, 2021 · 11 comments
Milestone

Comments

@longwa
Copy link

longwa commented Oct 26, 2021

On the main view with VM's listed to the left and status to the right, clicking the Share icon causes UTM to crash instantly.

This seems to happen for all of my VM's (both are x86, "Start from Scratch" on M1).

Configuration

  • UTM Version: 2.3.1
  • OS Version: 11.6
  • Apple Silicon

UTM_2021-10-26-121857.crash.log

@longwa
Copy link
Author

longwa commented Oct 26, 2021

The VM's are Oracle Linux 7.9 and CentOS 7 both with x86_64 emulation.

@osy
Copy link
Contributor

osy commented Oct 26, 2021

@ktprograms is this related to #3056

@ktprograms
Copy link
Contributor

@osy It's a Unexpectedly found nil while unwrapping an Optional value at

savePanel.beginSheetModal(for: nsView.window!) { result in

(Which was changed in cb7bba8)

For some reason in updateNSView(_:context:), nsView.window is still nil.

@osy
Copy link
Contributor

osy commented Oct 27, 2021

That means the view hasn't been loaded into a window yet. My guess is the layout system was preloading the view.

@ktprograms
Copy link
Contributor

Also when reproducing the error locally, Xcode has this runtime error/notice:
NSHostingView is being laid out reentrantly while rendering its SwiftUI content. This is not supported and the current layout pass will be skipped.

@ktprograms
Copy link
Contributor

That means the view hasn't been loaded into a window yet. My guess is the layout system was preloading the view.

@osy so should there be an if let and use savePanel.begin { result in if nsView.window is still nil?

@osy
Copy link
Contributor

osy commented Oct 27, 2021

Also when reproducing the error locally, Xcode has this runtime error/notice:
NSHostingView is being laid out reentrantly while rendering its SwiftUI content. This is not supported and the current layout pass will be skipped.

Can you try wrapping data.alertMessage = with Dispatch.main.async? I think it's complaining that a non-main thread is modifying the SwiftUI state.

That means the view hasn't been loaded into a window yet. My guess is the layout system was preloading the view.

@osy so should there be an if let and use savePanel.begin { result in if nsView.window is still nil?

I think if nsView.window is nil, we just return. It means the view was being laid out before the user clicked on the button.

@ktprograms
Copy link
Contributor

ktprograms commented Oct 27, 2021

Can you try wrapping data.alertMessage = with Dispatch.main.async? I think it's complaining that a non-main thread is modifying the SwiftUI state.

@osy when I do that, the SavePanel pops up, and then within half a second Xcode shows the unwrapping nil fatal error.

Edit: If I add the if let window = nsView.window then it works but seems to take about twice as long to pop up

@osy
Copy link
Contributor

osy commented Oct 27, 2021

Are you sure the nil unwrapping is at nsView.window? It seems weird that the sheet modal shows up if window is nil.

@ktprograms
Copy link
Contributor

Yes, it's at nsView.window!.

@osy osy modified the milestones: v3.1, v2.3.2 Oct 29, 2021
@osy
Copy link
Contributor

osy commented Oct 29, 2021

Btw this doesn't seem to happen on macOS Monterey for me.

@osy osy closed this as completed in 3075268 Oct 29, 2021
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

No branches or pull requests

3 participants