move windows around before removing the focus order lists to prevent nasty segfault when it removes a window from an already freed list

This commit is contained in:
Dana Jansens 2003-09-08 00:58:10 +00:00
parent 237cc7278b
commit 50d7028334

View file

@ -366,16 +366,6 @@ void screen_set_num_desktops(guint num)
/* may be some unnamed desktops that we need to fill in with names */ /* may be some unnamed desktops that we need to fill in with names */
screen_update_desktop_names(); screen_update_desktop_names();
/* update the focus lists */
/* free our lists for the desktops which have disappeared */
for (i = num; i < old; ++i)
g_list_free(focus_order[i]);
/* realloc the array */
focus_order = g_renew(GList*, focus_order, num);
/* set the new lists to be empty */
for (i = old; i < num; ++i)
focus_order[i] = NULL;
/* move windows on desktops that will no longer exist! */ /* move windows on desktops that will no longer exist! */
for (it = client_list; it != NULL; it = it->next) { for (it = client_list; it != NULL; it = it->next) {
ObClient *c = it->data; ObClient *c = it->data;
@ -389,6 +379,16 @@ void screen_set_num_desktops(guint num)
/* change our desktop if we're on one that no longer exists! */ /* change our desktop if we're on one that no longer exists! */
if (screen_desktop >= screen_num_desktops) if (screen_desktop >= screen_num_desktops)
screen_set_desktop(num - 1); screen_set_desktop(num - 1);
/* update the focus lists */
/* free our lists for the desktops which have disappeared */
for (i = num; i < old; ++i)
g_list_free(focus_order[i]);
/* realloc the array */
focus_order = g_renew(GList*, focus_order, num);
/* set the new lists to be empty */
for (i = old; i < num; ++i)
focus_order[i] = NULL;
} }
void screen_set_desktop(guint num) void screen_set_desktop(guint num)