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 RearrangeableListContainer<> crashing on replacement operations #6424

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

smoogipoo
Copy link
Contributor

When handling range replacements, it first does a remove, then a sort, then an add, then a sort. The sort is intended to operate on drawable objects, but these do not yet exist because they haven't been added yet. In other words, the sort in-between the add and remove is causing the crash.

I've gone with the likely least-regressing path of making the sortItems() handle this case. I'd considered moving the events to the callback and doing a sort of "transaction", but there's quite a bit involved due to the sometimes-asynchronous operation of this container.
Maybe things could be better if we removed the asynchronous Add...

@bdach
Copy link
Collaborator

bdach commented Nov 14, 2024

Maybe things could be better if we removed the asynchronous Add...

With the kinds of usages we've got of this client-side, I don't think we can.

For no particular reason other than to see if it does the right thing,
and it does.
@smoogipoo
Copy link
Contributor Author

Yeah I mean I'm not even going to explore that route right now, it's working fine as it is minus this bug... Mentioned it in passing.

Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

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

Have pushed another test because the one you did only exercised a full replace, I wanted to see if a partial replace correctly handles item order (and it does, as expected).

Seems good to me...?

@bdach bdach enabled auto-merge November 14, 2024 12:47
@bdach bdach disabled auto-merge November 14, 2024 13:05
@bdach bdach merged commit 20c0c2c into ppy:master Nov 14, 2024
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants