#74 PyGLUT 1.43 segfaults if callbacks defined before windowcrea

v2.0.1
closed-fixed
GLUT (25)
5
2003-04-07
2003-03-28
No

PyGLUT 1.43 segfaults if one tries to call glutDisplayFunc, glutOverlayDisplay, glutKeyboardFunc, glutSpecialFunc, glutMouseFunc, glutMotionFunc, glutPassiveMotionFunc, glutVisibilityFunc before calling glutCreateWindow. glutIdleFunc succeeds, though. I haven't tested the other callbacks, but I'd imagine the ones which have to do with X Window interaction would crash.

I imagine this has to do with uninitialized X Window-related variables, and has a simple workaround: not making the mistake of not creating the window.

This isn't a particularly severe bug, but I imagine PyGLUT could raise an exception, which is much more developer-friendly than just segfaulting.

The following code crashes:

#!/usr/bin/env python

from OpenGL.GLUT import *
import sys

def display(): pass

glutInit(sys.argv)
glutInitDisplayMode(0)
glutInitWindowSize(500,500)
glutInitWindowPosition(0,0)
glutDisplayFunc(display)
glutCreateWindow("Bug")

##########

swapping the last two lines of the script obviously fixes it, but as I said above, I don't believe this is a proper solution.

Discussion

  • Mike C. Fletcher

    Logged In: YES
    user_id=34901

    Okay, this is now fixed in CVS. A RuntimeError is raised if
    glutGetWindow returns 0 (i.e. there's no current window)
    when a glutXXXFunc function is called. I wasn't able to
    figure out _why_ this was causing a crash, it should have
    just ignored the registered functions :( .

     
  • Mike C. Fletcher

    • milestone: --> v2.0.1
    • assigned_to: nobody --> mcfletch
    • status: open --> closed-fixed
     

Log in to post a comment.