1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Added clearing of callbacks on window destruction.

This commit is contained in:
Camilla Berglund 2012-12-23 16:08:17 +01:00
parent ed9e403750
commit be7ad339f7

View File

@ -494,6 +494,20 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
if (window == NULL)
return;
// Clear all callbacks to avoid exposing a half torn-down window object
window->windowPosCallback = NULL;
window->windowSizeCallback = NULL;
window->windowCloseCallback = NULL;
window->windowRefreshCallback = NULL;
window->windowFocusCallback = NULL;
window->windowIconifyCallback = NULL;
window->mouseButtonCallback = NULL;
window->cursorPosCallback = NULL;
window->cursorEnterCallback = NULL;
window->scrollCallback = NULL;
window->keyCallback = NULL;
window->charCallback = NULL;
// The window's context must not be current on another thread when the
// window is destroyed
if (window == _glfwPlatformGetCurrentContext())