Skip to content

Commit

Permalink
Merge pull request fyne-io#4620 from andydotxyz/fix/closecrash
Browse files Browse the repository at this point in the history
Fix two possible panics in closing
  • Loading branch information
andydotxyz authored Feb 8, 2024
2 parents e3a8b4b + bf8ca3b commit eb1627b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/app/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ 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
}

if stopHook == nil {
return *stopped
}

if *stopped == nil {
if stopped == nil || *stopped == nil {
return stopHook
}

Expand Down
2 changes: 1 addition & 1 deletion internal/driver/glfw/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,14 @@ 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 {
d.Quit()
} else if runtime.GOOS == "darwin" {
go d.focusPreviousWindow()
}
w.DestroyEventQueue()
}

func (w *window) processMoved(x, y int) {
Expand Down

0 comments on commit eb1627b

Please sign in to comment.