diff --git a/gui.go b/gui.go
index <HASH>..<HASH> 100644
--- a/gui.go
+++ b/gui.go
@@ -6,6 +6,7 @@ package gocui
 
 import (
 	"errors"
+	"sync"
 
 	"github.com/nsf/termbox-go"
 )
@@ -28,6 +29,9 @@ type Gui struct {
 	keybindings []*keybinding
 	maxX, maxY  int
 
+	// Protects the gui from being flushed concurrently.
+	mu sync.Mutex
+
 	// BgColor and FgColor allow to configure the background and foreground
 	// colors of the GUI.
 	BgColor, FgColor Attribute
@@ -254,6 +258,9 @@ func (g *Gui) handleEvent(ev *termbox.Event) error {
 
 // Flush updates the gui, re-drawing frames and buffers.
 func (g *Gui) Flush() error {
+	g.mu.Lock()
+	defer g.mu.Unlock()
+
 	if g.layout == nil {
 		return errors.New("Null layout")
 	}
Protect Gui from being flushed concurrently