Lock until replacement is initialized

This fixes a race condition in which the Application.draw is called from
the event loop before the replacement screen is fully initialized in the
screen event goroutine. This is also how it works in Application.Run.
pull/503/head
Rafael Lukas Maers 4 years ago
parent 53d50e499b
commit 573db3ced4

@ -282,12 +282,12 @@ func (a *Application) Run() error {
// We have a new screen. Keep going.
a.Lock()
a.screen = screen
a.Unlock()
// Initialize and draw this screen.
if err := screen.Init(); err != nil {
panic(err)
}
a.Unlock()
a.draw()
}
}()

Loading…
Cancel
Save