aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-18 23:23:09 +0200
committerSven Gothel <[email protected]>2013-04-18 23:23:09 +0200
commit5eee4251b781e90ac66c33a2a1bcb7f2f6cf736a (patch)
tree57a931f7a50be8ed5889443916d2b285491d73fa
parent0a7cd9c58537d80131dbebf102f1f639ca0eb334 (diff)
GLJPanel: Avoid NPE of 'backend' in getChosenGLCapabilities() and DisposeGLEventListenerAction.run() ; Make 'backend' volatile due to possible multi-threading access.
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 2a68b89d3..1da7001fd 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -163,7 +163,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private int viewportY;
// The backend in use
- private Backend backend;
+ private volatile Backend backend;
// Used by all backends either directly or indirectly to hook up callbacks
private Updater updater = new Updater();
@@ -633,7 +633,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
- return backend.getChosenGLCapabilities();
+ if(null != backend) {
+ return backend.getChosenGLCapabilities();
+ }
+ return null;
}
@Override
@@ -830,7 +833,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public void run() {
- listener = helper.disposeGLEventListener(GLJPanel.this, backend.getDrawable(), backend.getContext(), listener, remove);
+ if( null != backend ) {
+ listener = helper.disposeGLEventListener(GLJPanel.this, backend.getDrawable(), backend.getContext(), listener, remove);
+ }
}
};