[PATCH 4/4] xwayland: Fixme: Free windows in hash

Martin Minarik minarik11 at student.fiit.stuba.sk
Tue Jul 3 14:10:11 PDT 2012


Use custom wrapper iterator function for destroying each window in hash.
---
 src/xwayland/window-manager.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 6e032ea..5d7e653 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -718,6 +718,12 @@ weston_wm_window_create(struct weston_wm *wm,
 }
 
 static void
+weston_wm_window_destroy_iterator_func(void *element, void *data)
+{
+	weston_wm_window_destroy(element);
+}
+
+static void
 weston_wm_window_destroy(struct weston_wm_window *window)
 {
 	hash_table_remove(window->wm->window_hash, window->id);
@@ -1212,7 +1218,8 @@ weston_wm_create(struct weston_xserver *wxs)
 void
 weston_wm_destroy(struct weston_wm *wm)
 {
-	/* FIXME: Free windows in hash. */
+	hash_table_for_each(wm->window_hash,
+		weston_wm_window_destroy_iterator_func, NULL);
 	hash_table_destroy(wm->window_hash);
 	xcb_disconnect(wm->conn);
 	wl_event_source_remove(wm->source);
-- 
1.7.9.5



More information about the wayland-devel mailing list