Skip to content

Commit

Permalink
gui-linux: Add reproducer for hardstop issue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cfergeau committed Mar 29, 2024
1 parent c319894 commit bf698c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions example/gui-linux/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ func run(ctx context.Context) error {
}
}()

go func() {
if !vm.CanStop() {
log.Println("cannot stop vm forcefully")
return
}
time.Sleep(10 * time.Second)
log.Println("calling vm.Stop()")

vm.Stop()
}()

// cleanup is this function is useful when finished graphic application.
cleanup := func() {
for i := 1; vm.CanRequestStop(); i++ {
Expand Down

0 comments on commit bf698c9

Please sign in to comment.