Multiple Newt-Windows crashes since jogl-2.0-b18
Posted by Marc@56K on Jan 19, 2011; 7:20pm
URL: https://forum.jogamp.org/Multiple-Newt-Windows-crashes-since-jogl-2-0-b18-tp2289695.html
Hi,
the following code worked fine on jogl 2.0 beta 10. Now I updated to jogl-2.0-b18-windows-i586 and it crashed.
public class NewtMultiWindowBug extends Thread implements GLEventListener
{
public static void main(String[] args)
{
try
{
for(int i=0; i<10; i++)
{
new NewtMultiWindowBug().start();
//Thread.sleep(1000);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
private GLWindow window;
public void run()
{
this.window = GLWindow.create(new GLCapabilities(GLProfile.get("GL2GL3")));
this.window.addGLEventListener(this);
this.window.setVisible(true);
while(true)
{
window.display();
}
}
@Override
public void display(GLAutoDrawable drawable)
{
}
@Override
public void dispose(GLAutoDrawable arg0)
{
}
@Override
public void init(GLAutoDrawable drawable)
{
}
@Override
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
{
}
}
Each window is running in a separate thread. If I wait one second after the creation of a window it worked. Without the sleep most threads crashed with a NullPointerException:
Exception in thread "Thread-3" java.lang.NullPointerException
at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1493)
at javax.media.opengl.GLProfile.get(GLProfile.java:548)
at javax.media.opengl.GLProfile.get(GLProfile.java:555)
at de.bht.jvr.tests.NewtMultiWindowBug.run(NewtMultiWindowBug.java:35)
...