mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
cmd,example: bump gio version
Add os.Exit to examples now that app.Main never returns. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -6,6 +6,8 @@ package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
|
||||
"gioui.org/app"
|
||||
"gioui.org/io/event"
|
||||
@@ -31,13 +33,19 @@ func main() {
|
||||
app.Main()
|
||||
}
|
||||
|
||||
var windowCount int32
|
||||
|
||||
func newWindow() {
|
||||
atomic.AddInt32(&windowCount, +1)
|
||||
go func() {
|
||||
w := new(window)
|
||||
w.Window = app.NewWindow()
|
||||
if err := w.loop(w.Events()); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if c := atomic.AddInt32(&windowCount, -1); c == 0 {
|
||||
os.Exit(0)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user