Repository navigation
Detach character views before closing all characters - #7795
Merged
Merged
Conversation
"Save none" closed every character before clearing the party list, so the character tabs still had field handlers attached to closed characters until the list change arrived. Clear the list first, matching removeCharacter, so views detach while the characters are still usable. Add regression tests for the close order and for FormattedFieldHandler forwarding only "value" changes (PCGen#7790).
Contributor
🚧 PCGen Code Coverage
|
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.
Follow-up to #7790.
#7790 stopped
FormattedFieldHandlerfrom treating every property change (e.g.ancestorduring frame disposal) as a value edit. That removed the trigger of the quit-time NPE, but not the underlying condition: a handler still attached to a closed character.One path still produces that condition on master. When more than one character is unsaved and the user picks Save none,
CharacterManager.removeAllCharacters()closed every character before clearing the party list.CharacterTabsonly detaches the tab models (clearStateMap→storeModels→uninstall) when it receives the list change, so for that window the UI fields stayed bound to closed characters.Changes
removeAllCharacters()now snapshots the open characters, clears the party list first so views detach, and then closes each character. This matches the orderremoveCharacter()already uses.CharacterManagerTest: list listeners are notified before any character is closed, and every character is still closed.FormattedFieldHandlerTest: regression coverage for Fix NPE in age field handler when closing PCGen #7790. Non-value property changes are not forwarded, committed values are, and an uninstalled handler is inert.Verification
CharacterManagerTestfails on the old order (expected: <[]> but was: <[first, second]>) and passes with the change.FormattedFieldHandlerTestfails (but was: <[5, 5, 5]>)../gradlew buildpasses.The only other listener on the party list,
CompanionSupportFacadeImpl.elementsChanged, iterates the now-empty list and does nothing.