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.