JVM crash in JOGL

I’m getting a JVM SIGSEGV when removing a GLJPanel from its AWT container. Here is an extract of the JVM dump. Can anyone provide any insights?

Stack: [0xb45a9000,0xb45fa000), sp=0xb45f8430, free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libX11.so.6+0x2dfd7] XQueryExtension+0x17
C [libX11.so.6+0x22d4b] XInitExtension+0x3b
C [libXext.so.6+0xc443] XextAddDisplay+0x53
C [libGL.so.1+0x1961d]
C [libGL.so.1+0x1a0cf] __glXInitialize+0x1f
C [libGL.so.1+0x1b22d] __glXSetupForCommand+0x4d
C [libGL.so.1+0x190b6]
C [libjogl.so+0x48bf1] Java_com_sun_opengl_impl_x11_GLX_glXDestroyContext__JJ+0x3e
j com.sun.opengl.impl.x11.GLX.glXDestroyContext(JJ)V+0
j com.sun.opengl.impl.x11.X11GLContext.destroyImpl()V+78
j com.sun.opengl.impl.GLContextImpl.destroy()V+60
j javax.media.opengl.GLJPanel.removeNotify()V+77
J java.awt.Container.remove(I)V
J java.awt.Container.remove(Ljava/awt/Component;)V
j com.maplesoft.mathdoc.view.plot.Plot3DCanvasView$PlotGLPanel.setCanvasView(Lcom/maplesoft/mathdoc/view/plot/Plot3DCanvasView;)V+75

You need to remove the GLJPanel from the AWT thread. Otherwise the GLJPanel is not able to perform any OpenGL operations, specially the ones needed to destory the context.

You may use the function Swingutilities.invokeLater for this.