Bug 370

Summary: Potential crash calling glXDestroyContext
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: linux   
Type: DEFECT SCM Refs:
Workaround: ---

Description Sven Gothel 2010-03-24 07:51:45 CET


---- Reported by djclayworth 2009-03-26 14:17:59 ----

I have been debugging an issue which showed up on Ubuntu 8.04 and 8.10. My
application asks for a context, and JOGl creates an X11GLContext in response. An
attempt to make this context current then fails, as sometimes happens, and a
GLException is correctly thrown. My application then destroys the context. At
the point of destroying the context a core dump occurs, generating an hs_err file. 

Closer inspection shows that in X11GLContext the variable 'mostRecentDisplay' is
not set during either the constructor, createContext() or makeCurrentImpl() (if
GLX.glXMakeCurrent() returns false). However in destroyImpl() there is a call
GLX.glXDestroyContext(mostRecentDisplay, context). The value of
mostRecentDisplay is zero.

I believe that this is the cause of the problem. The documentation I have found
for glXDestroyContext() does not indicate that null is a valid input. If I
modify a local copy of JOGl to set mostRecentDisplay to drawable.getDisplay()
then the crash does not occur.

I haven't tested this code change very much; it just seems to work in our case.
I hope this is helpful.



--- Bug imported by sgothel@jausoft.com 2010-03-24 07:51 EDT  ---

This bug was previously known as _bug_ 370 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=370