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).
This commit is contained in:
Stefan Haller 2026-05-07 20:40:09 +02:00
parent 670565c175
commit 79440c0945

View file

@ -97,7 +97,6 @@ func (self *AppStatusHelper) renderAppStatus() {
prevAppStatus := ""
for range ticker.C {
appStatus, color := self.statusMgr().GetStatusString(self.c.UserConfig())
self.c.Views().AppStatus.FgColor = color
update := self.c.OnUIThreadContentOnly
if utils.StringWidth(appStatus) != utils.StringWidth(prevAppStatus) {
@ -108,6 +107,7 @@ func (self *AppStatusHelper) renderAppStatus() {
update = self.c.OnUIThread
}
update(func() error {
self.c.Views().AppStatus.FgColor = color
self.c.SetViewContent(self.c.Views().AppStatus, appStatus)
return nil
})