Fix crash when dragging card as discard phase ends#37419
Merged
bdach merged 3 commits intoppy:masterfrom Apr 20, 2026
Merged
Conversation
…ld compred to itself yielded non-zero result if it was being dragged)
Collaborator
|
I gotta say, all this code is playing some very dangerous games as far as I can tell. Not sure that I would have spotted that in review originally but looking at all this from the failure angle there's a lot of dicey.
All of which is a long-winded way to say "reluctantly approved for hotfix purposes". |
bdach
approved these changes
Apr 20, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes: #37402
Issue was
HandOfCards.CardContainer.Compareworking under the assumption that the it would never be called with the same child for both entries, which can happen when doing aBinarySearch(called inRemoveInternal).This lead to
IndexOfreturning a negative value despite the card being present in the container, and the drawable getting disposed but not actually removed.I also included a precautionary
cardContainer.Sort()call before the removal as well, seemed to work without that from testing but better not rely on that.TLDR: card container child sorting was unstable due to poor assumptions