This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Make pending event handling more lenient to allow out of order responses#23504
Merged
gspencergoog merged 2 commits intoflutter:masterfrom Jan 8, 2021
Merged
Make pending event handling more lenient to allow out of order responses#23504gspencergoog merged 2 commits intoflutter:masterfrom
gspencergoog merged 2 commits intoflutter:masterfrom
Conversation
06624b2 to
162534b
Compare
162534b to
cd2bd95
Compare
Contributor
|
Does this happen to other platforms as well? |
Contributor
Author
|
Yes, Windows did (but I already fixed that in my pending PR), and Android needs a similar fix, which I'll work on today. |
Contributor
Author
|
@dkwingsmt I mean, actually, I haven't seen this same problem on other platforms, but I'm going to proactively fix the algorithm that the others are using (macOS doesn't use the same algorithm) to not assume that order is always preserved. |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Jan 8, 2021
| for (guint i = 0; i <= self->pending_events->len; ++i) { | ||
| if (FL_KEY_EVENT_PAIR(g_ptr_array_index(self->pending_events, i))->id == | ||
| id) { | ||
| return FL_KEY_EVENT_PAIR(g_ptr_array_index(self->pending_events, 0)) |
Contributor
There was a problem hiding this comment.
You're testing against index i, but then still returning index 0.
Contributor
Author
There was a problem hiding this comment.
Thanks for finding that. I'll submit a fix today.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR makes the Linux key handling code a little more lenient when it comes to the order in which it receives responses to key events from the framework. I had assumed that there wasn't a case where responses could get out of order, but it seems that it is possible, given that you can mash on the keyboard and eventually get one out of order.
This changes the code so that instead of just looking at the first entry in the pending event deque, it searches the deque starting at the beginning to find the event, and remove it.
Related Issues
Tests