On Tue, 3 Nov 2020 18:41:20 GMT, Sergey Bylokhov <[email protected]> wrote:
>> Alexander Zuev has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Test case made multiplatform and testing all the LaF's
>
> test/jdk/javax/swing/JMenu/PopupReferenceMemoryLeak.java line 57:
>
>> 55: try {
>> 56: // Set system look and feel
>> 57:
>> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
>
> I suggest checking all installed L&Fs for example
> https://github.com/openjdk/jdk/pull/989/files
Fixed
> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java
> line 1229:
>
>> 1227: // and uninstall menu keybindings
>> 1228: removeItems();
>> 1229: menuInputMap = null;
>
> Just curious, will the uninstall(); at the start of the method will clear
> this flag as well?
We do call ninstall() at the beginning of the method but it does not resolve
the issue.
> test/jdk/javax/swing/JMenu/PopupReferenceMemoryLeak.java line 89:
>
>> 87: for(int i=0; i<3; i++) {
>> 88: try {
>> 89: ArrayList gc = new ArrayList();
>
> It will be useful to call System.gc() and limit the size of the heap via -mx
System.gc() does not affect test in any way so i just left it out.
> test/jdk/javax/swing/JMenu/PopupReferenceMemoryLeak.java line 100:
>
>> 98: }
>> 99: robot.waitForIdle();
>> 100: robot.keyPress(KeyEvent.VK_ALT);
>
> Can we skip the robot interaction and instead show the popup menu ourselves?
> (not via menu items)
No, unfortunately one of the mechanics i'm testing only reproducible when popup
is being opened from JMenuBar.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1035