diff --git a/internal/model/backlog.go b/internal/model/backlog.go index c19db36e..a53da31a 100644 --- a/internal/model/backlog.go +++ b/internal/model/backlog.go @@ -5,6 +5,7 @@ import ( "io" "io/ioutil" "sort" + "sync" "time" "github.com/rs/zerolog/log" @@ -17,6 +18,7 @@ import ( // to-do list. type Backlog struct { Tasks []Task + Mtx sync.RWMutex } // A Task remains to be done (or dropped) but is not yet scheduled. diff --git a/internal/ui/panes/tasks_pane.go b/internal/ui/panes/tasks_pane.go index 90ba818c..ba2924e6 100644 --- a/internal/ui/panes/tasks_pane.go +++ b/internal/ui/panes/tasks_pane.go @@ -86,6 +86,9 @@ func (p *TasksPane) Draw() { // draw tasks func() { + p.backlog.Mtx.RLock() + defer p.backlog.Mtx.RUnlock() + yIter := y + 1 for _, task := range p.backlog.Tasks { yIter += 1