Synchronize access to GlWindow. This seems to help with freezing

This commit is contained in:
Sollace 2018-07-03 19:14:30 +02:00
parent a5b0e187a0
commit b7d17d594c

View file

@ -37,7 +37,7 @@ public class GLWindow extends DropTarget {
/** /**
* Gets or creates the current GLWindow context. * Gets or creates the current GLWindow context.
*/ */
public static GLWindow current() { public static synchronized GLWindow current() {
if (instance == null) { if (instance == null) {
instance = new GLWindow(); instance = new GLWindow();
} }
@ -218,7 +218,7 @@ public class GLWindow extends DropTarget {
} }
} }
public void clearDropTargetListener() { public synchronized void clearDropTargetListener() {
if (ready && dropListener != null) { if (ready && dropListener != null) {
removeDropTargetListener(dropListener); removeDropTargetListener(dropListener);
dropListener = null; dropListener = null;
@ -226,7 +226,7 @@ public class GLWindow extends DropTarget {
} }
} }
public void setDropTargetListener(DropTargetListener dtl) { public synchronized void setDropTargetListener(DropTargetListener dtl) {
if (!ready) { if (!ready) {
return; return;
} }