How to avoid Native Crashes?

I have a nice MDI world editor implemented using JOGL. The editor consists of multiple windows (JInternalFrame instances in a JDesktopPane) of which one contains a GLCanvas. In theory everything’s working just fine. However I’m occasionally experiencing the following problems:

When focusing to the GLCanvas window, an exception is thrown out of the display method: “GLException: Error swapping buffers”. This happens always and is easy to reproduce in a simple MDI application (There is submitted repro-case in the issue tracker, dealing with same kind of problems. ID: 30). This sometimes leads to a complete JVM crash.

ps. I’m using the latest JOGL release with WinXP, Radeon 9700 Pro (with the latest drivers). I’m not using the built-in Animator, but another solution based on a similar concept.

GLCanvases or GLJPanels in a JInternalFrame are actually removed from the rendering heirarchy when you iconize them. When you deiconize them a repaint event is called before the GLCanvas or GLJPanel is available for painting causing the buffer swap error. I still have to check if the fix works with Ken’s new code in the cvs. If it works I will send it to him later this week.

To quote my idol, “That’d be grrrreeat.” 8)

That’s the only serious problem I’m having with JOGL as of today. So, thank you in advance!

Out of curiosity, can I ask what was fixed? JDesktopPane? JInternalFrame? GLCanvas? Or maybe something under the native JOGL hood?

Iconization requires that if the rendering thread is set, Animator is being used for example, then that thread must unload the current context so it can be destroyed. After the context is destroyed it will pause the rendering thread so it isn’t pounding an invisible context with repaint requests. Deiconization recreates the GLCanvas from scratch calling init and so on.