Windows: stack push/pop mismatch calling NoOpGeneric
Submitted by Nicolas Coderre
Assigned to Kristian H. Kristensen @krh
Description
2010/4/7 Nicolas Coderre nicolas.coderre@gmail.com:
Hello Kristian,
Hi Nicolas,
I've just upgraded from Mesa 7.3 to version 7.8.1, and I'm having some issues on shutdown.
I'm using Ogre v 1.6.4, and it has the nasty habit of calling some gl functions after the glcontext has been released. I know this is a bad API usage, but it seems that the above change replaced a benign noop function call with a bad stack corruption issue. The NoOpGeneric function doesn't pop the stack correctly.
Haven't heard of this one before now. What do you mean it doesn't pop the stack correctly? Can you open a bug in bugs.freedesktop.org assign it to me and attach a stack trace?
thanks, Kristian
Popping the stack correctly: I should clarify. Based on my debug run, I have observed in this piece of code in glapitemp.h:
KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint * textures) { DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);\n", n, (const void *) textures)); }
The code pushes two arguments on the stack, then calls the function as specified in the function table. In this particular situation, the glcontext is closed, so the function table is pointing to NoOpGeneric. NoOpGeneric takes no arguments, therefore fails to pop the 2 pushed arguments from the stack. On return of this function, I get a runtime warning that my stack is bad.
I can give more information if required.
Repro should be: build mesa non-debug ( so that TABLE_ENTRY(name) is defined as NoOpGeneric) init gl, shutdown glcontext, then call glDeleteTextures(1, &ptr);
Version: 7.8