Made Application.Draw() thread-safe (for real this time). Fixes #136

pull/151/head
Oliver 6 years ago
parent 100f053ee1
commit cc64ead1ed

@ -227,13 +227,14 @@ func (a *Application) Suspend(f func()) bool {
// Draw refreshes the screen. It calls the Draw() function of the application's
// root primitive and then syncs the screen buffer.
func (a *Application) Draw() *Application {
a.RLock()
a.Lock()
defer a.Unlock()
screen := a.screen
root := a.root
fullscreen := a.rootFullscreen
before := a.beforeDraw
after := a.afterDraw
a.RUnlock()
// Maybe we're not ready yet or not anymore.
if screen == nil || root == nil {

Loading…
Cancel
Save