Fix removing OSWindow breaking pointer references in glfw

This commit is contained in:
Kovid Goyal 2017-11-16 16:39:54 +05:30
parent 528573ac80
commit c4bcda80e9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 3 additions and 6 deletions

View File

@ -47,10 +47,7 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
// callbacks {{{
void
remove_os_window_reference(OSWindow *w) { if (w->handle) glfwSetWindowUserPointer(w->handle, NULL); }
static inline void
void
update_os_window_references() {
for (size_t i = 0; i < global_state.num_os_windows; i++) {
OSWindow *w = global_state.os_windows + i;

View File

@ -182,7 +182,6 @@ bool
remove_os_window(id_type os_window_id) {
bool found = false;
WITH_OS_WINDOW(os_window_id)
remove_os_window_reference(os_window);
found = true;
make_os_window_context_current(os_window);
END_WITH_OS_WINDOW
@ -190,6 +189,7 @@ remove_os_window(id_type os_window_id) {
WITH_OS_WINDOW_REFS
REMOVER(global_state.os_windows, os_window_id, global_state.num_os_windows, OSWindow, destroy_os_window_item, global_state.capacity);
END_WITH_OS_WINDOW_REFS
update_os_window_references();
}
return found;
}

View File

@ -134,7 +134,7 @@ void gl_init();
void remove_vao(ssize_t vao_idx);
bool remove_os_window(id_type os_window_id);
void make_os_window_context_current(OSWindow *w);
void remove_os_window_reference(OSWindow *w);
void update_os_window_references();
void mark_os_window_for_close(OSWindow* w, bool yes);
void update_os_window_viewport(OSWindow *window, bool);
bool should_os_window_close(OSWindow* w);