x11: Remove destroy listener when X11 window is destroyed

This commit is contained in:
Kristian Høgsberg 2011-12-27 22:47:51 -05:00
parent a42c128201
commit facb558448
1 changed files with 3 additions and 0 deletions

View File

@ -691,6 +691,7 @@ wlsc_wm_handle_create_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
return;
}
memset(window, 0, sizeof *window);
window->id = create_notify->window;
hash_table_insert(wm->window_hash, window->id, window);
}
@ -714,6 +715,8 @@ wlsc_wm_handle_destroy_notify(struct wlsc_wm *wm, xcb_generic_event_t *event)
fprintf(stderr, "destroy window %p\n", window);
hash_table_remove(wm->window_hash, window->id);
if (window->surface)
wl_list_remove(&window->surface_destroy_listener.link);
free(window);
}