mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +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.
|
||||
for {
|
||||
select {
|
||||
case f, ok := <-u.funcs:
|
||||
if ok {
|
||||
f()
|
||||
} else {
|
||||
u.funcs = nil
|
||||
}
|
||||
case f := <-u.funcs:
|
||||
f()
|
||||
case err := <-ch:
|
||||
// ch returns a value not only when an error occur but also it is closed.
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -251,7 +248,6 @@ func (u *userInterface) Terminate() error {
|
||||
glfw.Terminate()
|
||||
return nil
|
||||
})
|
||||
close(u.funcs)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user