Threading issues: 2 GLCanvases in one JFrame

I have been very pleased with the results of working with JOGL, running under Mac OS 10.3.2, using Java 1.4.2. I have read the User’s Guide and am in a general way aware that there are threading issues with JOGL. I recently encountered such a problem, when I tried to pack two GLCanvases (each representing a different camera viewing the same scene graph) into one JFrame. The program complained as follows:

        java.lang.IllegalMonitorStateException: current thread not owner
              at net.java.games.jogl.impl.JAWT_DrawingSurface.Unlock0(Native Method)
              at net.java.games.jogl.impl.JAWT_DrawingSurface.Unlock(JAWT_DrawingSurface.java:60)
              at net.java.games.jogl.impl.macosx.MacOSXOnscreenGLContext.unlockSurface(MacOSXOnscreenGLContext.java:236)
... (more stack frames)

and also complained about deallocing memory that hadn’t been allocated.

Can someone provide either or both of the following:
1) A simplified explanation of exactly what the thread problem here is?
2) A solution for the problem.

Thanks in advance.

Basically an IllegalMonitorStateException means that a piece of code is calling Object.wait on a object it doesn’t own. Perhaps Greg would comment further since I don’t do Mac. I have an app with 4 GLCanvas working just fine.

Can’t comment specifically on this one yet as I have the same problem. Its not just JOGL canvas instances either. I’ve been having some trouble getting JOGL to work while another OpenGL application was running at the same time.

Note, what you’re doing isn’t the ideal way to do it. What you really want to do is render the multiple camera perspectives into multiple viewports using glViewport - not use multiple canvas instances.