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

8165214: ListView.EditEvent.getIndex() does not return the correct index #539

Closed
wants to merge 2 commits into from

Conversation

kleopatra
Copy link
Collaborator

@kleopatra kleopatra commented Jun 21, 2021

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

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8165214: ListView.EditEvent.getIndex() does not return the correct index

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 21, 2021

👋 Welcome back fastegal! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Jun 21, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 21, 2021

Webrevs

@@ -352,6 +352,8 @@ public void changed(
* Editing API *
* *
**************************************************************************/
// index at time of startEdit - fix for JDK-8165214
int indexAtStartEdit;
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

indeed, thanks :)

@johanvos
Copy link
Collaborator

This looks the correct approach indeed. Tests fail before and succeed after.
That is, the first test succeeds before as well, but it makes sense as there is no action that would change the index. So I don't think it is accidentally passing?

@kleopatra
Copy link
Collaborator Author

This looks the correct approach indeed. Tests fail before and succeed after.
That is, the first test succeeds before as well, but it makes sense as there is no action that would change the index. So I don't think it is accidentally passing?

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.

Copy link
Collaborator

@johanvos johanvos left a 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.

@openjdk
Copy link

openjdk bot commented Jun 22, 2021

@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:

8165214: ListView.EditEvent.getIndex() does not return the correct index

Reviewed-by: jvos, aghaisas

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 master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Jun 22, 2021
@kleopatra
Copy link
Collaborator Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 23, 2021

Going to push as commit 04493e5.

@openjdk openjdk bot closed this Jun 23, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated rfr Ready for review labels Jun 23, 2021
@openjdk
Copy link

openjdk bot commented Jun 23, 2021

@kleopatra Pushed as commit 04493e5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@kleopatra kleopatra deleted the bug-fix-8165214 branch June 23, 2021 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
4 participants