From 88092a49bf8af936f49d6e365586df91b6739cd1 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 23 Aug 2006 23:24:23 +0000 Subject: [PATCH] add debug/error catching SVN revision: 25081 --- src/bin/e_hints.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index efd866a8f..1dd2d03f3 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -290,13 +290,12 @@ e_hints_client_stacking_set(void) num += e_container_borders_count(c); } } - - clients = calloc(num, sizeof(Ecore_X_Window)); - if (!clients) - return; if (num > 0) { + clients = calloc(num, sizeof(Ecore_X_Window)); + if (!clients) return; + for (ml = e_manager_list(); ml; ml = ml->next) { m = ml->data; @@ -305,15 +304,35 @@ e_hints_client_stacking_set(void) c = cl->data; bl = e_container_border_list_first(c); while ((b = e_container_border_list_next(bl))) - clients[i++] = b->win; + { + if (i >= num) + { + e_error_message_show("e_hints.c: e_hints_client_stacking_set()
" + "
" + "Window list size greater than window count.
" + "This is really bad.
" + "Please report this."); + break; + } + clients[i++] = b->win; + } e_container_border_list_free(bl); } } + if (i < num) + { + e_error_message_show("e_hints.c: e_hints_client_stacking_set()
" + "
" + "Window list size less than window count.
" + "This is strange, but not harmful.
" + "Please report this."); + } for (ml = e_manager_list(); ml; ml = ml->next) { m = ml->data; ecore_x_netwm_client_list_stacking_set(m->root, clients, num); } + E_FREE(clients); } else { @@ -323,7 +342,6 @@ e_hints_client_stacking_set(void) ecore_x_netwm_client_list_stacking_set(m->root, NULL, 0); } } - E_FREE(clients); } EAPI void