-
Notifications
You must be signed in to change notification settings - Fork 29k
Fix GTK redraw call being called from non-GTK thread. #173602
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 GTK redraw call being called from non-GTK thread. #173602
Conversation
gtk_widget_queue_draw is not thread-safe, call it from an idle callback. Fixes flutter#173447
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
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.
Code Review
This pull request correctly addresses a thread-safety issue by moving the gtk_widget_queue_draw
call into an idle callback, ensuring it runs on the main GTK thread. The logic for handling the first frame has also been consolidated into the new redraw_cb
function. This not only fixes the bug but also improves the code's structure and thread safety regarding the have_first_frame
flag. The changes are well-implemented and effectively resolve the issue.
The fix was found by enabling tsan in the Flutter engine build. It also showed some potential issues coming from the Linux task runner, which I will investigate in the future. |
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.
Just a thought, but feel free to merge!
Also - I tested and it works well for me! CC: @loic-sharma |
test-exempt: unblocks enabling tooling that catches it |
Failed to create CP due to merge conflicts. |
@robert-ancell @loic-sharma We'll need to manually CP this to https://github.com/flutter/flutter/tree/flutter-3.35-candidate.0. Can one of you help out here? Thanks! |
gtk_widget_queue_draw is not thread-safe, call it from an idle callback. Fixes flutter#173447
gtk_widget_queue_draw is not thread-safe, call it from an idle callback. Fixes flutter#173447
And cherry pick for 3.36 branch as requested by @loic-sharma in #173669 |
gtk_widget_queue_draw is not thread-safe, call it from an idle callback.
Fixes #173447