Bug 370 - Potential crash calling glXDestroyContext
Summary: Potential crash calling glXDestroyContext
Status: VERIFIED WORKSFORME
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All linux
: P3 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2009-03-26 02:17 CET by Sven Gothel
Modified: 2010-11-10 20:41 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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