From cdbf3f42ea530f91639536e03b2c203715c3c300 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Fri, 19 Apr 2013 01:19:48 -0700 Subject: Test for null against a temp variable to narrow races Signed-off-by: Harvey Harrison --- .../classes/javax/media/opengl/awt/GLJPanel.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 1da7001fd..a8c7f7eb2 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -510,7 +510,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public GLContext createContext(GLContext shareWith) { - return (null != backend) ? backend.createContext(shareWith) : null; + Backend b = backend; + if (b == null) + return null; + + return b.createContext(shareWith); } @Override @@ -633,10 +637,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public GLCapabilitiesImmutable getChosenGLCapabilities() { - if(null != backend) { - return backend.getChosenGLCapabilities(); - } - return null; + Backend b = backend; + if (b == null) + return null; + + return b.getChosenGLCapabilities(); } @Override @@ -833,8 +838,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public void run() { - if( null != backend ) { - listener = helper.disposeGLEventListener(GLJPanel.this, backend.getDrawable(), backend.getContext(), listener, remove); + Backend b = backend; + if (null != b) { + listener = helper.disposeGLEventListener(GLJPanel.this, b.getDrawable(), b.getContext(), listener, remove); } } }; -- cgit v1.2.3