On Fri, 13 Dec 2024 22:12:58 GMT, Alexander Zvegintsev <azveg...@openjdk.org> 
wrote:

>> src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java line 550:
>> 
>>> 548:                             
>>> addWaylandWindowFocusListenerToWindow(oppositeWindow);
>>> 549:                             return;
>>> 550:                         }
>> 
>> So it's possible now that several windows in a hierarchy will have the 
>> listener added… Won't the listener be leaked? In other words, do we always 
>> remove the listener?
>
> As far as my tests with an instrumented build show - yes, but I discovered 
> another case not covered:
> 
> 
> for (int i = 0; i <= 1; i++) {
>     JMenu menu = new JMenu("Menu " + i);
>     menu.add(new JTextField("JTextField " + i));
>     popupMenu.add(menu);
> }
> 
> 
> Clicking on gnome text editor does not hide the menu if the second menu is 
> open. I do have a fix for it, but will not rush to post it, as I do not have 
> enough time to test it thoroughly.
> I will move this PR to draft status as I will be on vacation starting next 
> week.

Updated to cover this case by adding the listener to all owned windows.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22729#discussion_r1921680298

Reply via email to