mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21:14:35 +00:00
Added clearing of callbacks on window destruction.
This commit is contained in:
parent
ed9e403750
commit
be7ad339f7
14
src/window.c
14
src/window.c
@ -494,6 +494,20 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
|
|||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return;
|
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
|
// The window's context must not be current on another thread when the
|
||||||
// window is destroyed
|
// window is destroyed
|
||||||
if (window == _glfwPlatformGetCurrentContext())
|
if (window == _glfwPlatformGetCurrentContext())
|
||||||
|
Loading…
Reference in New Issue
Block a user