Skip to content

Commit 79440c0

Browse files
committed
Set the view color on the UI thread too
Unrelated to this branch, just because we're touching this code: there's little reason to set the color on the background thread but the text on the UI thread. Set them both together on the UI thread. Avoids a data race (unlikely to be a problem in practice, we're talking about a 64-bit int, but still).
1 parent 670565c commit 79440c0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/gui/controllers/helpers/app_status_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ func (self *AppStatusHelper) renderAppStatus() {
9797
prevAppStatus := ""
9898
for range ticker.C {
9999
appStatus, color := self.statusMgr().GetStatusString(self.c.UserConfig())
100-
self.c.Views().AppStatus.FgColor = color
101100

102101
update := self.c.OnUIThreadContentOnly
103102
if utils.StringWidth(appStatus) != utils.StringWidth(prevAppStatus) {
@@ -108,6 +107,7 @@ func (self *AppStatusHelper) renderAppStatus() {
108107
update = self.c.OnUIThread
109108
}
110109
update(func() error {
110+
self.c.Views().AppStatus.FgColor = color
111111
self.c.SetViewContent(self.c.Views().AppStatus, appStatus)
112112
return nil
113113
})

0 commit comments

Comments
 (0)