diff options
author | Harvey Harrison <[email protected]> | 2013-04-19 01:19:48 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-04-19 01:19:48 -0700 |
commit | cdbf3f42ea530f91639536e03b2c203715c3c300 (patch) | |
tree | 91e1d9b12fb78823e3ca1b561a10a2cedb7d26e5 /src/jogl/classes/javax/media/opengl | |
parent | 5eee4251b781e90ac66c33a2a1bcb7f2f6cf736a (diff) |
Test for null against a temp variable to narrow races
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 20 |
1 files changed, 13 insertions, 7 deletions
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); } } }; |