New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix timeout if the portal DBus is not present #4800
Conversation
Just update a cache when the value is found and refresh app
app/app_xdg.go
Outdated
func defaultVariant() fyne.ThemeVariant { | ||
return findFreedestktopColorScheme() | ||
return currentVariant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I think this might be introducing a race condition given that it is modified in a different goroutine? Might be worth using something like an atomic.Pointer
or a lock?
Looks like some Ubuntu/Microsoft dependency has taken down the build CI setup :( |
Whatever the problem was it is fixed upstream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I realised that there was a cleaner and faster way to do this 😅
app/app_xdg.go
Outdated
@@ -20,8 +20,15 @@ import ( | |||
"fyne.io/fyne/v2/theme" | |||
) | |||
|
|||
var currentVariant atomic.Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I actually have a better idea. Given that fyne.ThemeVariant
is a uint, you can get cleaner and faster code by just using an atomic.Uint64
and cast the value to a fyne.ThemeVariant
where loading and storing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. Thanks
Just update a cache when the value is found and refresh app
Checklist: