mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user