Skip to content

Commit

Permalink
Fix a possible crash if opening a window during shutdown
Browse files Browse the repository at this point in the history
This may not be the desired solution as it commits to close as soon as there are no windows.
A future change could address fyne-io#467 to add a veto-close function.
  • Loading branch information
andydotxyz committed Jun 15, 2020
1 parent 3c58408 commit bf2d3dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/driver/glfw/loop.go
Expand Up @@ -137,6 +137,10 @@ func (d *gLDriver) runGL() {
d.windowLock.Lock()
d.windows = newWindows
d.windowLock.Unlock()

if len(newWindows) == 0 {
d.Quit()
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/glfw/window.go
Expand Up @@ -452,7 +452,7 @@ func (w *window) destroy(d *gLDriver) {
w.eventLock.Unlock()
}

if w.master || len(d.windowList()) == 0 {
if w.master {
d.Quit()
} else if runtime.GOOS == "darwin" {
d.focusPreviousWindow()
Expand Down

0 comments on commit bf2d3dc

Please sign in to comment.