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
8165214: ListView.EditEvent.getIndex() does not return the correct index #539
Conversation
👋 Welcome back fastegal! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -352,6 +352,8 @@ public void changed( | |||
* Editing API * | |||
* * | |||
**************************************************************************/ | |||
// index at time of startEdit - fix for JDK-8165214 | |||
int indexAtStartEdit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this field should be private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, thanks :)
This looks the correct approach indeed. Tests fail before and succeed after. |
maybe "accidentally" is wrong word :) I meant it in the sense I summarized in JDK-8266969: all cell types have issues with configuring edit events with incorrect locations, some take the control's location at the time of the cancel (like ListCell), some take the cell's. For all there are execution paths that carry the correct (which I call "accidental") and some that carry the wrong location. For ListCell the "accidentally" correct locations are set on cell-reuse and after cancel on the cell, the incorrect are all others. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and it's great to see old bugs being tackled.
@kleopatra This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 04493e5. |
@kleopatra Pushed as commit 04493e5. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Issue was that the cancel event carried the listView's editingIndex at the time of firing the event - that's wrong nearly always (because the list's editing state/index might have changed between start and cancel, f.i. due to calling list.edit(someDifferentIndex)).
Fixed by keeping the index at startEdit and using that in cancelEdit (similar approach as in TreeCell fix TreeCell fix JDK-8265210.
Added tests that are failing (and one that was accidentally passing) before, all passing after.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/539/head:pull/539
$ git checkout pull/539
Update a local copy of the PR:
$ git checkout pull/539
$ git pull https://git.openjdk.java.net/jfx pull/539/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 539
View PR using the GUI difftool:
$ git pr show -t 539
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/539.diff