mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
ui: Bug fix: ui.funcs might be closed before sending a value
This commit is contained in:
parent
82d7cee5a3
commit
612d3b07b0
@ -84,13 +84,10 @@ func (u *userInterface) main(ch <-chan error) error {
|
|||||||
// TODO: Check this is done on the main thread.
|
// TODO: Check this is done on the main thread.
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case f, ok := <-u.funcs:
|
case f := <-u.funcs:
|
||||||
if ok {
|
f()
|
||||||
f()
|
|
||||||
} else {
|
|
||||||
u.funcs = nil
|
|
||||||
}
|
|
||||||
case err := <-ch:
|
case err := <-ch:
|
||||||
|
// ch returns a value not only when an error occur but also it is closed.
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,7 +248,6 @@ func (u *userInterface) Terminate() error {
|
|||||||
glfw.Terminate()
|
glfw.Terminate()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
close(u.funcs)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user