Hi Sergey, The fix looks good to me. I think you can make the test generic once JDK-8204142 is fixed.
Thanks, Dmitry > On 24 Oct 2018, at 22:31, Sergey Bylokhov <sergey.bylok...@oracle.com> wrote: > > Hello. > Please review the fix for jdk 12. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8211435 > Webrev: http://cr.openjdk.java.net/~serb/8211435/webrev.00 > > Bug description: > > In the DefaultKeyboardFocusManager class we have a special field > "activeWindow", which stores the currently active window. It is used in two > similar cases: > 1. If the java window gets "WINDOW_ACTIVATED" event it will try to send > "WINDOW_DEACTIVATED" to the old active window, which is stored in the > "activeWindow" field. > 2. If the java component lost the focus, and the opposite component is not a > java component, then it will try to send "WINDOW_DEACTIVATED" to the old > active window, which is stored in the "activeWindow" field. > > The difference in these two cases is that in "case 1" we check the old active > window to null[1], and the second case has no such check. The bug is > reproduced in non-standalone mode, when we have a few Appcontexts and this > field might be updated by different EDT in parallel. > > Note that the test is for OSX only, because of another bug: JDK-8204142[2] > > > [1] > http://hg.openjdk.java.net/jdk/jdk/file/ad9077f044be/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java#l527 > [2] https://bugs.openjdk.java.net/browse/JDK-8204142 > > > -- > Best regards, Sergey.