So, basically I’m adding and removing multiple GLCanvases to JPanels. If I do this from the “main” thread, meaining the thread that the programs main() method is running in, all works well. But If I slap a thread around exactly the same code (like adding
public static void main(String[] args) {new Thread(){public void run(){ … }}.start }
instead of just
public static void main(String[] args) { … }
It crashed with something like this:
An unexpected error has been detected by HotSpot Virtual Machine:
SIGSEGV (0xb) at pc=0x00b01376, pid=14394, tid=2798631856
Java VM: Java HotSpot™ Client VM (1.5.0_01-b08 mixed mode)
Problematic frame:
C [libGL.so.1+0x38376]
--------------- T H R E A D ---------------
Current thread (0xa7914fd0): JavaThread “Thread-16” [_thread_in_native, id=14454]
siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x00000034
Registers:
EAX=0x0839f970, EBX=0x00000000, ECX=0xffffffc0, EDX=0x08474800
ESP=0xa6cfadec, EBP=0xa6cfae50, ESI=0x08474800, EDI=0xa7914fd0
EIP=0x00b01376, CR2=0x00000034, EFLAGS=0x00010282
Top of Stack: (sp=0xa6cfadec)
0xa6cfadec: 08474800 0839f970 01cfae14 00b0163e
0xa6cfadfc: 08474800 00000001 a74fc2a0 ad452600
0xa6cfae0c: a7914fd0 08095000 00000000 00afbcb3
0xa6cfae1c: 08474800 0839f970 a749e12d 08474800
0xa6cfae2c: 0839f970 a6cfae58 a749e100 0839f970
0xa6cfae3c: 00000000 08474800 00000000 b2929a7b
0xa6cfae4c: ad452600 a6cfae8c b292f42b a791508c
0xa6cfae5c: a6cfae94 08474800 00000000 0839f970
Instructions: (pc=0x00b01376)
0x00b01366: 4c 24 14 88 4c 24 0b 8b 0d 68 d2 b3 00 65 8b 19
0x00b01376: 83 7b 34 00 74 24 8b 43 04 50 53 e8 76 1a 00 00
Stack: [0xa6c7b000,0xa6cfc000), sp=0xa6cfadec, free space=511k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libGL.so.1+0x38376]
j net.java.games.jogl.impl.x11.GLX.glXDestroyContext(JJ)V+0
j net.java.games.jogl.impl.x11.X11GLContext.destroyImpl()V+21
j net.java.games.jogl.impl.GLContext.destroy()V+33
j net.java.games.jogl.GLCanvas.removeNotify()V+4
j java.awt.Container.removeNotify()V+38
j javax.swing.JComponent.removeNotify()V+1
j java.awt.Container.removeAll()V+82
j
… etc.
I have tried fiddling around with the -DJOGL_SINGLE_THREADED_WORKAROUND=true
but no change.
It always seems to happen when I am either adding or removing GLCanvases (I’ve seen essentially teh same error happen while adding and while removing).
It ALWAYS ends up dying at: net.java.games.jogl.impl.x11.GLX.glXDestroyContext
Bits from glxinfo, driver is :
NVIDIA-Linux-x86-1.0-6629-pkg1.run
on system: Intel 4, Linux 2.6.10 (custom kernel, but nothing special)
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.3
server glx extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_ARB_multisample, GLX_NV_float_buffer
client glx vendor string: NVIDIA Corporation
client glx version string: 1.3
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_SGI_video_sync,
GLX_NV_swap_group, GLX_NV_video_out, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGI_swap_control, GLX_NV_float_buffer
GLX extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_ARB_multisample, GLX_NV_float_buffer, GLX_ARB_get_proc_address
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce FX 5700/AGP/SSE2
OpenGL version string: 1.5.2 NVIDIA 66.29
OpenGL extensions: