diff --git a/wayland/wayland-client.c b/wayland/wayland-client.c index 932f8b4..6a27514 100644 --- a/wayland/wayland-client.c +++ b/wayland/wayland-client.c @@ -413,8 +413,18 @@ wl_display_connect(const char *name) WL_EXPORT void wl_display_destroy(struct wl_display *display) { + struct wl_global *global, *gnext; + struct wl_global_listener *listener, *lnext; + wl_connection_destroy(display->connection); wl_hash_table_destroy(display->objects); + wl_list_for_each_safe(global, gnext, + &display->global_list, link) + free(global); + wl_list_for_each_safe(listener, lnext, + &display->global_listener_list, link) + free(listener); + close(display->fd); free(display); } diff --git a/wayland/wayland-server.c b/wayland/wayland-server.c index 886ec69..017db08 100644 --- a/wayland/wayland-server.c +++ b/wayland/wayland-server.c @@ -617,10 +617,10 @@ WL_EXPORT void wl_display_destroy(struct wl_display *display) { struct wl_socket *s, *next; + struct wl_global *global, *gnext; - wl_event_loop_destroy(display->loop); - wl_hash_table_destroy(display->objects); - + wl_event_loop_destroy(display->loop); + wl_hash_table_destroy(display->objects); wl_list_for_each_safe(s, next, &display->socket_list, link) { close(s->fd); unlink(s->addr.sun_path); @@ -629,6 +629,9 @@ wl_display_destroy(struct wl_display *display) free(s); } + wl_list_for_each_safe(global, gnext, &display->global_list, link) + free(global); + free(display); }