Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information