1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Fix race with HighlightableHelper

GetRect can lead to a race condition
Add a RenderFunc method so that we can call try to
wrap even more of our rendering in the thread safe
`QueueUpdateDraw` method
This commit is contained in:
Sean Smith
2019-08-24 22:05:37 -04:00
parent 3f5fe6f3e5
commit 264f49fd2c
12 changed files with 69 additions and 45 deletions

View File

@@ -71,13 +71,14 @@ func (widget *Widget) Render() {
return
}
title := fmt.Sprintf("%s - %s stories", widget.CommonSettings().Title, widget.settings.storyType)
widget.Redraw(title, widget.contentFrom(widget.stories), false)
widget.RedrawFunc(widget.content)
}
/* -------------------- Unexported Functions -------------------- */
func (widget *Widget) contentFrom(stories []Story) string {
func (widget *Widget) content() (string, string, bool) {
title := fmt.Sprintf("%s - %s stories", widget.CommonSettings().Title, widget.settings.storyType)
stories := widget.stories
var str string
for idx, story := range stories {
@@ -94,7 +95,7 @@ func (widget *Widget) contentFrom(stories []Story) string {
str += utils.HighlightableHelper(widget.View, row, idx, len(story.Title))
}
return str
return title, str, false
}
func (widget *Widget) openStory() {