diff --git a/internal/app/lifecycle.go b/internal/app/lifecycle.go index 6d5acd7cb5..9e125c900e 100644 --- a/internal/app/lifecycle.go +++ b/internal/app/lifecycle.go @@ -82,7 +82,7 @@ func (l *Lifecycle) OnStarted() func() { func (l *Lifecycle) OnStopped() func() { stopped := l.onStopped.Load() stopHook := l.onStoppedHookExecuted - if stopped == nil && stopHook == nil { + if (stopped == nil || *stopped == nil) && stopHook == nil { return nil } @@ -90,7 +90,7 @@ func (l *Lifecycle) OnStopped() func() { return *stopped } - if *stopped == nil { + if stopped == nil || *stopped == nil { return stopHook } diff --git a/internal/driver/glfw/window.go b/internal/driver/glfw/window.go index cb35a75c7f..2605bee4f1 100644 --- a/internal/driver/glfw/window.go +++ b/internal/driver/glfw/window.go @@ -272,7 +272,6 @@ func (w *window) processClosed() { // destroy this window and, if it's the last window quit the app func (w *window) destroy(d *gLDriver) { - w.DestroyEventQueue() cache.CleanCanvas(w.canvas) if w.master { @@ -280,6 +279,7 @@ func (w *window) destroy(d *gLDriver) { } else if runtime.GOOS == "darwin" { go d.focusPreviousWindow() } + w.DestroyEventQueue() } func (w *window) processMoved(x, y int) {