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

gui: Watch vm state to terminate when it's stopped #154

Closed
wants to merge 2 commits into from

Commits on Nov 19, 2024

  1. gui-linux: Add reproducer for hardstop issue

    When calling vm.Stop() while using the GUI, the VM stops, but
    the GUI is not closed and the application keeps running.
    Using vm.RequestStop() does not have this issue.
    
    This commit modifies example/gui-linux to exhibit the issue.
    cfergeau committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    6cfd2d4 View commit details
    Browse the repository at this point in the history
  2. gui: Watch vm state to terminate when it's stopped

    The GUI code in virtualization_view.m is notified when there was a guest
    initiated shutdown ('guestDidStopVirtualMachine') and when there was a
    virtualization error ('didStopWithError').
    
    When calling Stop(), the VM is forcefully stopped (similar to pulling
    the plug on real hardware). This action is neither a guest initiated
    shutdown, nor a virtualization error, so the GUI code does not catch
    it. This means after calling vm.Stop(), the GUI main loop will keep
    running, and the application using Code-Hex/vz will never exit.
    
    This commit fixes this by adding an observer for VM state changes, and
    by calling 'terminate' when the VM state becomes 'stopped' or 'error'.
    
    This fixes Code-Hex#150
    cfergeau committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    999f00a View commit details
    Browse the repository at this point in the history