From: <NM...@th...> - 2002-03-27 22:43:02
|
Hi, After doing some debugging I made the following change to my source. In file : OpenGL_Win32_jawt.c In the method : gljDestroyNative We were trying to delete a context with : disp__wglDeleteContext(gc). An error was occurring on my system (WinNT), I think, because the context being deleted (gc) belonged to a thread other than the current thread and thus threw an EXCEPTION_ACCESS_VIOLATION. Previous to this (a few lines up from the above) we were calling : disp__wglMakeCurrent( NULL, NULL ) , which detaches the rendering context from the current thread and makes it non-current, in preparation for deletion. This call, however, was failing on my system. I am assuming it was failing, again, because the current thread did not hold the rendering context. I am not exactly sure why the thread did not own the context. I must admit, my experience with GL Windows programming is very limited. But here is what I did to fix my error : I changed disp__wglMakeCurrent( NULL, NULL ) to disp__wglMakeCurrent( thisWin, gc ) so that the current thread now owns the context. Then, when it gets around to deleting it a few lines later, no error occurs. According to MSDN the disp__wglDeleteContext(gc) call will actually change the rendering context to being non-current before deleting so really the original disp__wglMakeCurrent( NULL, NULL ) was redundant. The only important thing is to make sure that the current thread owns the context before deleting it. Is it a hack? I don't know. Thoughts? It has stopped my error though. Thanks, Noah Keen |---------+---------------------------------------------> | | "Kenneth B. Russell" | | | <kbr...@al...> | | | Sent by: | | | gl4...@li...ur| | | ceforge.net | | | | | | | | | 03/26/2002 12:03 AM | | | Please respond to kbrussel | | | | |---------+---------------------------------------------> >----------------------------------------------------------------------------------------------| | | | To: NM...@th... | | cc: gl4...@li... | | Subject: Re: [gl4java-usergroup] GLCanvas Dispose on NT | >----------------------------------------------------------------------------------------------| > My application needs to swap a GLCanvas and a JPanel in and out of a GUI > Container(JSplitPane). Currently I am destroying a GLCanvas with cvsDispose > () and then rebuilding by recalling the constructor with each swap. > > ... > > On a WinNT machine this call causes a EXCEPTION_ACCESS_VIOLATION outside of > the Java VM. It is happening in the gljDestroyNative() method in > OpenGL_Win32_jawt.c when the native disp_wglDeleteContext(gc) call is > made(Line 713). There is pretty clearly something wrong in that code, as that line is executing entirely inside a block guarded by "if (gc == 0)". Please spend some time and debug it if you can, then send in a patch. Otherwise we'll look at it after JavaOne. BTW, Sven is in San Francisco this week and he and I are giving a talk on OpenGL for Java this Thursday morning at 11. If any of you are at the conference we hope to see you there. _______________________________________________ gl4java-usergroup mailing list gl4...@li... https://lists.sourceforge.net/lists/listinfo/gl4java-usergroup |