Fix crash when meta_display_close() is called with attached modal dialogs

When meta_display_unmanage_window_for_screen() is called, it gets a list
of windows and iterates over them and unmanages them, but unmanaging a
window with attached modal dialogs also unmanages those attached modal
dialogs (in the normal case, temporarily), so we need to guard against
such cases by ref'ing the windows in the list and checking if they have
already been unmanaged.

https://bugzilla.gnome.org/show_bug.cgi?id=668299
https://bugzilla.redhat.com/show_bug.cgi?id=760918
This commit is contained in:
Owen W. Taylor 2012-01-19 14:06:57 -05:00
parent 1772a2a59c
commit c0a440b852

View File

@ -5025,12 +5025,21 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
winlist = meta_display_list_windows (display,
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
winlist = g_slist_sort (winlist, meta_display_stack_cmp);
g_slist_foreach (winlist, (GFunc)g_object_ref, NULL);
/* Unmanage all windows */
tmp = winlist;
while (tmp != NULL)
{
meta_window_unmanage (tmp->data, timestamp);
MetaWindow *window = tmp->data;
/* Check if already unmanaged for safety - in particular, catch
* the case where unmanaging a parent window can cause attached
* dialogs to be (temporarily) unmanaged.
*/
if (!window->unmanaging)
meta_window_unmanage (window, timestamp);
g_object_unref (window);
tmp = tmp->next;
}