RFR: 8308875: java/awt/Toolkit/GetScreenInsetsCustomGC/GetScreenInsetsCustomGC.java failed with 'Cannot invoke "sun.awt.X11GraphicsDevice.getInsets()" because "device" is null'
Maxim Kartashev
mkartashev at openjdk.org
Mon Jun 19 12:06:17 UTC 2023
On Mon, 5 Jun 2023 17:51:27 GMT, Phil Race <prr at openjdk.org> wrote:
>> 8308875 is a regression after the recent [fix for 8305578](https://github.com/openjdk/jdk/commit/d7245f70) that effectively undid a part of [another, older, change](https://github.com/openjdk/jdk/commit/40f6d697d25293282e3d3ee695ef8cd9a5494799), the one made to fix [8233573](https://bugs.openjdk.org/browse/JDK-8233573).
>>
>> This commits brings that part back and passes the test `java/awt/Toolkit/GetScreenInsetsCustomGC/GetScreenInsetsCustomGC.java` on Linux, so the test is also removed from the ProblemList file.
>
> I note that the previous fix "undid" similar code on windows and mac as well.
> Any explanation why it only causes a problem for Linux ?
@prrace
> I note that the previous fix "undid" similar code on windows and mac as well.
> Any explanation why it only causes a problem for Linux ?
Now that I've looked at the code, I don't understand the statement "the previous fix "undid" similar code on windows and mac as well". If by "the previous fix" you mean the fix for 8305578, then it did *not* introduce the same problem on MacOS/Windows as it did for Linux. Compare the relevant parts of `getScreenInsets()` before this one has been integrated:
Linux:
final X11GraphicsDevice device = (X11GraphicsDevice) gc.getDevice();
Insets insets = device.getInsets();
MacOS:
if (!(gd instanceof CGraphicsDevice)) {
return super.getScreenInsets(gc);
}
Windows:
if (!(gd instanceof Win32GraphicsDevice)) {
return super.getScreenInsets(gc);
}
Only Linux will fail in case of a "custom" `GraphicsConfiguration`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14170#issuecomment-1597060568
More information about the client-libs-dev
mailing list