diff --git a/internal/driver/glfw/window.go b/internal/driver/glfw/window.go index 12432b153f..d09459cfd0 100644 --- a/internal/driver/glfw/window.go +++ b/internal/driver/glfw/window.go @@ -253,11 +253,11 @@ func (w *window) Canvas() fyne.Canvas { func (w *window) processClosed() { if w.onCloseIntercepted != nil { - w.QueueEvent(w.onCloseIntercepted) + w.onCloseIntercepted() return } - go w.Close() // unsure which thread this comes from, so don't block + w.Close() } // destroy this window and, if it's the last window quit the app diff --git a/internal/driver/glfw/window_test.go b/internal/driver/glfw/window_test.go index 03ff71b450..b7d69dd57d 100644 --- a/internal/driver/glfw/window_test.go +++ b/internal/driver/glfw/window_test.go @@ -1683,7 +1683,7 @@ func TestWindow_CloseInterception(t *testing.T) { closed := make(chan bool, 1) w.SetOnClosed(func() { closed <- true }) w.closed(w.viewport) - w.WaitForEvents() + assert.True(t, onIntercepted, "the interceptor should have been called") select { case <-closed: @@ -1700,7 +1700,7 @@ func TestWindow_CloseInterception(t *testing.T) { closed := make(chan bool, 1) w.SetOnClosed(func() { closed <- true }) w.closed(w.viewport) - w.WaitForEvents() + select { case <-closed: case <-time.After(20 * time.Millisecond):