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

Bug fix: Confirm & stop the VM when the user closes the window if it is neither idle nor stopped. #389

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

sundresh
Copy link
Contributor

@sundresh sundresh commented Aug 8, 2024

I noticed that I can close a VM window while it's paused without being prompted whether to stop the VM. But after that, when I try to start the same VM again from the Virtual Buddy window, it's unable to start due to the error "Failed to lock auxiliary storage." That's because the paused VM was not actually stopped. This was clear because exiting and restarting Virtual Buddy does allow me to start the same VM again.

This PR changes the close VM window behavior to present the confirmation alert and (if confirmed) then stop the VM if it is in any state other than .idle or .stopped when the user attempts to close the window. (If the user interface presented the option to save the VM state while it's paused, we wouldn't need to prompt in the case the user pauses, saves, and then after the save completed, closes the window without unpausing.)

var isStarting: Bool {
guard case .starting = state else { return false }
var isStopped: Bool {
guard case .stopped = state else { return false }
return true
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reordered to match VMState.

@sundresh sundresh force-pushed the confirm_stop_vm_when_paused branch from 41224dd to 08389de Compare August 8, 2024 21:54
@insidegui insidegui merged commit 0fd9622 into insidegui:main Aug 21, 2024
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