RFR: 8283509: Invisible menus can lead to IndexOutOfBoundsException

Robert Lichtenberger rlichten at openjdk.java.net
Tue Mar 29 12:14:46 UTC 2022


On Tue, 29 Mar 2022 09:23:24 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

> 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.

-------------

PR: https://git.openjdk.java.net/jfx/pull/759


More information about the openjfx-dev mailing list