mvdhoning / gl2gx

OpenGL wrapper for GX on WII or Gamecube
26 stars 7 forks source link

Crash when user does not define a glutIdleFunc() #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take any gl2gx example
2. Comment out the call to glutIdleFunc() in the example
3. Compile and run, when the glutMainLoop() is called, the example will crash

What is the expected output? What do you see instead?
No crash and normal operation.

What version of the product are you using? On what operating system?
Latest, Wii

Please provide any additional information below.

The crash results from the library trying to invoke a NULL function.  In
glut.c:

void glutMainLoop(void){

     displayfunc();
     while(1) {
              idlefunc();  //<<< issue here
     }
}

One solution, is to check for a NULL, e.g.:

void glutMainLoop(void){

     displayfunc();
     while(1) {
              if (idlefunc != NULL)
                idlefunc();
              else
                 some_default_idle_func() //or just sleep here
     }
}

Original issue reported on code.google.com by michaelw...@gmail.com on 5 Apr 2009 at 12:45