-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Invoke GUI update calls in SetupDefaultSearch() descendants #3380
Conversation
Yeah, that would be a dream come true. That's why I mentioned |
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.
This looks like what's needed. Would be wise to have confirmation from somebody who has experienced the issue, so I'm happy to wait a day or three for that.
I will have a look shortly and get back to you
…On Mon, 24 May 2021, 01:20 HebaruSan, ***@***.***> wrote:
***@***.**** approved this pull request.
This looks like what's needed. Would be wise to have confirmation from
somebody who has experienced the issue, so I'm happy to wait a day or three
for that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3380 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7IZXMLDMV7DBH3BLOMHOTTPGETBANCNFSM45ME6ULA>
.
|
That won't help. You must update a GUI element in the GUI thread. Async/await does not do this for you. To update a GUI from a different worker thread you have to use Invoke. I always do: GuiElement.Invoke(() => expression); |
@DasSkelett I can confirm this fixes my issue |
Right, the problem is that the cognitive load for doing this by hand across an entire application is unsustainable/impracticable. If we tagged all of our code that updates a GUI property directly as |
Problem
With the restructuring to the search done in #3323 we added a call to
SetupDefaultSearch()
, which indirectly modifies GUI controls through other functions it calls.As we all know, updating GUI components from another thread basically doesn't work.
In this case it manifests itself through freezes at the end of the repository update for some users.
Changes
Now
ManageMods.Filter()
andManageMods.SetSearches()
, both called inSetupDefaultSearch()
, wrap every GUI-related work and call in aUtil.Invoke()
.The diff looks worse than the actual change 😄
I wonder if there's some static code analysis tool that can catch this? At least my IDE doesn't :/
I can't confirm the effectiveness of this patch, as my low core count tablet/laptop/convertible doesn't reproduce the hang/freeze (the runtime decides to run it all in a single thread there, I guess) and this only seems to affect Windows. I might dust off my Windows installation on my PC tomorrow to see if it experiences the bug.
Fixes #3379
@linuxgurugamer and @daantimmer, do you want to give this fix a try, after re-enabling the repo update on startup so it hits the critical code path?
If you click on the "Checks" tab in between the pull request header and body, there should be an "Artifacts" button on the right side, where you can download a ckan.exe built from this PR code.