summaryrefslogtreecommitdiff
path: root/src/gl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gl')
-rw-r--r--src/gl/window.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gl/window.c b/src/gl/window.c
index 1b8c4bb..fd13022 100644
--- a/src/gl/window.c
+++ b/src/gl/window.c
@@ -98,6 +98,11 @@ int window_destroy(lua_State *L)
void *ptr;
hs_parse_args(L, hs_light(ptr));
GLFWwindow *win = ptr;
+ void *wdata = glfwGetWindowUserPointer(win);
+ if (wdata != NULL) {
+ free(wdata);
+ glfwSetWindowUserPointer(win, NULL);
+ }
glfwDestroyWindow(win);
return 0;
}