Re: Right method to exit/dispose on linux
Posted by
Xerxes Rånby on
Feb 09, 2014; 9:21am
URL: https://forum.jogamp.org/Right-method-to-exit-dispose-on-linux-tp4031504p4031514.html
elect wrote
gouessej wrote
Instead of using an AWT Frame, a NewtCanvasAWT and a GLWindow, I suggest you to use correctly a single GLWindow, set its size, call setVisible(true), etc... I try to know whether your bug comes from NEWT, from AWT or from the NEWT AWT "bridge".
Ah, I got it :)
So:
final Tutorial04 tutorial04 = new Tutorial04();
GLWindow window = tutorial04.getGlWindow();
window.setSize(window.getWidth(), window.getHeight());
window.setVisible(true);Running fine for one second, then I get:
init
reshape (0, 0) (1024, 768)
display
display
display
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0.0, 0x7ffc3c09dd70, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0.0, 0x7ffc3c0d65a0, refCount 1, unCloseable false]As you can see, display is called 3 times and then crash. In that 3 calls, it actually draws properly (a red triangle)
This is expected, and is not a crash.
Your only thead, the main thread, has exited and you see the four X11Util lines when jogamp cleaning up before the jvm exit your application. You will see these lines unless your GLWindow has explicited been closed by you before the application exit.
If you want your application to keep running after main has exited then you should have spawned a new thread that keeps your application alive.
You can if you want keep the main thread alive in a loop that wait untill the glwindow has closed.