Skip to content

Conversation

@effad
Copy link

@effad effad commented Mar 22, 2022

findSibling adapted to only use visible menus when calculating the
index.


Progress

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

Issue

  • JDK-8283509: Invisible menus can lead to IndexOutOfBoundsException

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/759/head:pull/759
$ git checkout pull/759

Update a local copy of the PR:
$ git checkout pull/759
$ git pull https://git.openjdk.java.net/jfx pull/759/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 759

View PR using the GUI difftool:
$ git pr show -t 759

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/759.diff

findSibling adapted to only use visible menus when calculating the
index.
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 22, 2022

👋 Welcome back rlichten! 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 Mar 22, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 22, 2022

Webrevs

@kevinrushforth kevinrushforth requested a review from aghaisas March 25, 2022 16:23
@aghaisas
Copy link
Collaborator

Have you considered keeping the same while loop in findSibling() method and skipping invisible Menus in it?
This is to avoid creating and traversing a new list.

@effad
Copy link
Author

effad commented Mar 29, 2022

Have you considered keeping the same while loop in findSibling() method and skipping invisible Menus in it? This is to avoid creating and traversing a new list.

This would not give the correct result. findSibling must return the index in the list of visible menus, since this is what setFocusedMenuIndex() really expects. If we only skip invisible menus we will possibly return an index that is out of bounds, which is exactly what this bug is about.

@aghaisas
Copy link
Collaborator

Have you considered keeping the same while loop in findSibling() method and skipping invisible Menus in it? This is to avoid creating and traversing a new list.

This would not give the correct result. findSibling must return the index in the list of visible menus, since this is what setFocusedMenuIndex() really expects. If we only skip invisible menus we will possibly return an index that is out of bounds, which is exactly what this bug is about.

OK. Thanks for the explanation.
The fix and the test looks good.

Only one minor correction needed is in comment.
// Traverse all menus in menubar to find nextIndex
should be
// Traverse all visible menus in menubar to find nextIndex

@effad
Copy link
Author

effad commented Mar 30, 2022

Only one minor correction needed is in comment.

Right. Just pushed a correction.

@openjdk
Copy link

openjdk bot commented Mar 30, 2022

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

8283509: Invisible menus can lead to IndexOutOfBoundsException

Reviewed-by: 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 3 new commits pushed to the master branch:

  • a0db473: 8280369: native library cache should be platform/arch specific
  • d1fb3d3: 8283517: Update boot JDK to 18
  • 424aeba: 8277309: Add support for H.265/HEVC to HTTP Live Streaming

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@aghaisas) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label Mar 30, 2022
@effad
Copy link
Author

effad commented Mar 30, 2022

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label Mar 30, 2022
@openjdk
Copy link

openjdk bot commented Mar 30, 2022

@effad
Your change (at version 6d511a3) is now ready to be sponsored by a Committer.

@aghaisas
Copy link
Collaborator

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 30, 2022

Going to push as commit cff84e2.
Since your change was applied there have been 3 commits pushed to the master branch:

  • a0db473: 8280369: native library cache should be platform/arch specific
  • d1fb3d3: 8283517: Update boot JDK to 18
  • 424aeba: 8277309: Add support for H.265/HEVC to HTTP Live Streaming

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 30, 2022
@openjdk openjdk bot closed this Mar 30, 2022
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review sponsor Ready to sponsor labels Mar 30, 2022
@openjdk
Copy link

openjdk bot commented Mar 30, 2022

@aghaisas @effad Pushed as commit cff84e2.

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

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

Development

Successfully merging this pull request may close these issues.

2 participants