[OpenJDK 2D-Dev] [13] Review Request: 6933331 (d3d/ogl) java.lang.IllegalStateException: Buffers have not been created

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue May 14 22:15:47 UTC 2019


Hello.
Please review the fix for JDK 13.

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

While working on enabling LCD rendering on macOS via BufferStrategy rendering, I was able to find this bug, which was previously mainly reported on Windows where we use this code path. Usually the problem described as an intermittent exception after "changing display resolutions", and I think that the root cause is that in such intermittent situations we will recreate the peer of the component when we cannot update the  GraphicConfig information on the fly in the java.awt.Component.java:
=========
void setGraphicsConfiguration(GraphicsConfiguration gc) {
1155         synchronized(getTreeLock()) {
1156             if (updateGraphicsData(gc)) {
1157                 removeNotify();
1158                 addNotify();
1159             }
1160         }
1161     }
=========

The bug can be easily reproduced if we will enable buffer strategy for the Window, and then dispose of the Window, and show again. In this case, the Window will drop internal buffers used by the bufferstrategy in the removeNotify() method, and we will get an exception when later the buffer strategy will try to use them.

As a solution, I suggest recreating the backbuffers in the bufferStrategy if the old buffer was disposed of.

-- 
Best regards, Sergey.


More information about the 2d-dev mailing list