app: don't deadlock on wakeup arriving after window closure

The previous change wasn't enough, because the `dead` channel wasn't
being closed in an orderly window close.

Add a close of the event output channel in the premature close code path
to match the orderly close.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-05-19 22:46:53 +02:00
parent d5b70c439c
commit f8d201b7c2
+2
View File
@@ -391,6 +391,7 @@ func (w *Window) destroy(err error) {
w.ack <- struct{}{}
w.out <- system.DestroyEvent{Err: err}
close(w.dead)
close(w.out)
for e := range w.in {
w.ack <- struct{}{}
if _, ok := e.(system.DestroyEvent); ok {
@@ -427,6 +428,7 @@ func (w *Window) waitFrame() (*op.Ops, bool) {
func (w *Window) run(opts *wm.Options) {
defer close(w.out)
defer close(w.dead)
if err := wm.NewWindow(&w.callbacks, opts); err != nil {
w.out <- system.DestroyEvent{Err: err}
return