Skip to content
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 a host crash in LazyListUpdateProcessor #2177

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

swankjesse
Copy link
Collaborator

I introduced a bug in the mechanism that attempts to replace animated inserts and removes with update-in-place transitions.

The crash occurs when the before window shrinks while the total number of elements is growing. The previous code naively assumed the before window shrinking would always be a scroll, but it can coincide with a content change.

Closes: #2172


  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

I introduced a bug in the mechanism that attempts to replace
animated inserts and removes with update-in-place transitions.

The crash occurs when the before window shrinks while the total
number of elements is growing. The previous code naively
assumed the before window shrinking would always be a scroll,
but it can coincide with a content change.

Closes: #2172
@swankjesse swankjesse requested a review from dnagler July 10, 2024 22:25
processor.items.insert(6, "I")
processor.onEndChanges()
processor.scrollTo(0, 12)
assertThat(processor.toString()).isEqualTo(". . C D E Fv2 G H I . . .")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v2 after F here means there was an update-in-place, rather than a structural change. I’d like to do a follow-up to make these all say v2, which is how we reduce the glitchy animations in update processing.

processor.itemsAfter(2)
processor.onEndChanges()
processor.scrollTo(0, 12)
assertThat(processor.toString()).isEqualTo(". . . Cv2 D E F G H I . .")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same v2 thing.

Copy link
Collaborator

@dnagler dnagler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Collaborator

@colinmarsch colinmarsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix! The tests look great!

@swankjesse swankjesse merged commit de44817 into trunk Jul 10, 2024
11 checks passed
@swankjesse swankjesse deleted the jwilson.0710.fix_shift_crash branch July 10, 2024 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UncaughtTreehouseException: toIndex = 1
4 participants