Synchronize the create/destroy and instance access to GLWindow... -_-

This commit is contained in:
Sollace 2018-07-07 18:41:36 +02:00
parent 4ee7d2d88e
commit 5aafc83fd9

View file

@ -55,7 +55,7 @@ public class GLWindow extends DropTarget {
/** /**
* Destroys the current GLWindow context and restores default behaviour. * Destroys the current GLWindow context and restores default behaviour.
*/ */
public static void dispose() { public static synchronized void dispose() {
if (instance != null) { if (instance != null) {
instance.close(); instance.close();
} }
@ -87,7 +87,7 @@ public class GLWindow extends DropTarget {
return frame; return frame;
} }
private void open() throws LWJGLException { private synchronized void open() throws LWJGLException {
// Dimensions from LWJGL may have a non 1:1 scale on high DPI monitors. // Dimensions from LWJGL may have a non 1:1 scale on high DPI monitors.
int x = getScaledPixelUnit(Display.getX()); int x = getScaledPixelUnit(Display.getX());
int y = getScaledPixelUnit(Display.getY()); int y = getScaledPixelUnit(Display.getY());
@ -151,7 +151,7 @@ public class GLWindow extends DropTarget {
ready = true; ready = true;
} }
private void close() { private synchronized void close() {
closeRequested = true; closeRequested = true;
try { try {