mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
ui: Bug fix: closed channel never blocks
This commit is contained in:
parent
30b521f3b8
commit
8e58f3ce0a
@ -84,8 +84,12 @@ 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 := <-u.funcs:
|
case f, ok := <-u.funcs:
|
||||||
f()
|
if ok {
|
||||||
|
f()
|
||||||
|
} else {
|
||||||
|
u.funcs = nil
|
||||||
|
}
|
||||||
case err := <-ch:
|
case err := <-ch:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -232,7 +236,6 @@ func (u *userInterface) Terminate() error {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
close(u.funcs)
|
close(u.funcs)
|
||||||
u.funcs = nil
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user