Hash :
d44f3922
Author :
Date :
2014-07-07T10:33:32
Fixed bug 2629 - Mac: crash when calling SDL_DestroyWindow with an active OpenGL context
Alex Szpakowski
Since this commit https://hg.libsdl.org/SDL/rev/59b543340d63 , calling SDL_DestroyWindow will crash the program if the window has an active OpenGL context.
This is because the Cocoa_DestroyWindow code sets the window's driverdata to NULL and then calls [context setWindow:NULL], which tries to access the window's driverdata, resulting in a null pointer dereference.
I have attached a patch which fixes the issue by moving the line which sets the driverdata to NULL to after the lines which call functions that use the driverdata pointer.