Bug 391 - Race condition in GLStateTracker while accessing/reset the mapping
Summary: Race condition in GLStateTracker while accessing/reset the mapping
Status: VERIFIED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 2
Hardware: All all
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2010-03-26 17:22 CET by Sven Gothel
Modified: 2010-03-26 17:25 CET (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
cf95674e16d34a85191d3af0a35d1357e011fcac
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-26 17:22:27 CET
As shown below, the concurrent access of GLStateTracker
while being cleared by GLContext.destroy() causes a NPE.

GLContext.destroy() shall disable it first, then clear it.

The state stack pop method shall also swap the mapping 
with a most atomic action.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.sun.opengl.impl.GLStateTracker.getInt(GLStateTracker.java:94)
        at com.sun.opengl.impl.gl2.GL2Impl.glGetIntegerv(GL2Impl.java:6102)
        at com.sun.opengl.impl.gl2.GL2Impl.imageSizeInBytes(GL2Impl.java:26000)
        at com.sun.opengl.impl.gl2.GL2Impl.imageSizeInBytes(GL2Impl.java:25713)
        at com.sun.opengl.impl.gl2.GL2Impl.glTexImage2D(GL2Impl.java:18692)
        at glredbook1314.combiner.init(combiner.java:104)
        at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:88)
        at javax.media.opengl.awt.GLJPanel$Updater.init(GLJPanel.java:557)
        at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:88)
        at com.sun.opengl.impl.GLPbufferImpl$InitAction.run(GLPbufferImpl.java:274)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:149)
        at com.sun.opengl.impl.GLPbufferImpl.maybeDoSingleThreadedWorkaround(GLPbufferImpl.java:267)
        at com.sun.opengl.impl.GLPbufferImpl.swapBuffers(GLPbufferImpl.java:157)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:159)
        at javax.media.opengl.awt.GLJPanel.dispose(GLJPanel.java:238)

[junit] Testsuite: com.jogamp.opengl.test.junit.texture.awt.Texture1
    [junit] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    [junit] 	at com.sun.opengl.impl.GLStateTracker.getInt(GLStateTracker.java:94)
    [junit] 	at com.sun.opengl.impl.gl2.GL2Impl.glGetIntegerv(GL2Impl.java:6102)
    [junit] 	at com.sun.opengl.impl.gl2.GL2Impl.imageSizeInBytes(GL2Impl.java:26000)
    [junit] 	at com.sun.opengl.impl.gl2.GL2Impl.imageSizeInBytes(GL2Impl.java:25713)
    [junit] 	at com.sun.opengl.impl.gl2.GL2Impl.glTexImage2D(GL2Impl.java:18692)
    [junit] 	at com.sun.opengl.util.texture.Texture.updateImage(Texture.java:646)
    [junit] 	at com.sun.opengl.util.texture.Texture.updateImage(Texture.java:421)
    [junit] 	at com.sun.opengl.util.texture.Texture.<init>(Texture.java:183)
    [junit] 	at com.sun.opengl.util.texture.TextureIO.newTexture(TextureIO.java:394)
    [junit] 	at com.jogamp.opengl.test.junit.texture.util.gl2.TextureGL2ListenerDraw1.init(TextureGL2ListenerDraw1.java:56)
    [junit] 	at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:88)
    [junit] 	at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:603)
    [junit] 	at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:149)
    [junit] 	at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:553)
    [junit] 	at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:290)
Comment 1 Sven Gothel 2010-03-26 17:25:26 CET
Solved as described ..