<AWT Dev> RFR: 8239819 XToolkit: Misread of screen information memory

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Sat Feb 22 09:05:54 UTC 2020

Please review the fix for jdk/client.

Bug: https://bugs.openjdk.java.net/browse/JDK-8239819
Fix: http://cr.openjdk.java.net/~serb/8239819/webrev.00

The XAWT for some native structures uses special java wrappers. These
wrappers have to be created on top of the native pointer and provide
access to the native fields directly w/o JNI methods.

We have incorrect usage of such wrapper in the XToolkit class:
Toolkit creates AwtScreenData wrapper on top of the XToolkit.getDefaultScreenData()

But unfortunately, this native method returns the wrong pointer
to getDefaultConfig():

getScreenData() should be used instead of getDefaultConfig(), but since native
data for default configuration is bigger than screen data we most of the
time read some "random" information about visual info.

This code was added 17 years ago to set the background color of the
XIconWindow which is used as an icon in the dock/taskbar/minimized icon.
Looks like nobody noticed since then that the color used as a border is
incorrect, because this color is actually is invisible.
I have confirmed this  using different color variants and even checked
mwm(kind of cde on linux). So decided revert that fix back.

Best regards, Sergey.

More information about the awt-dev mailing list