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



commit c0a440b852a049cf37dc661fb5df9fd2dd8b80a4
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Jan 19 14:06:57 2012 -0500

    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

 src/core/display.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 1e7b48a..713114a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -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;
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]