[metacity] group: add error trap



commit 1ec420acc9fa40c6774ac58ef54d86ea7bf05a6c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Nov 1 20:51:06 2016 +0200

    group: add error trap
    
    https://bugs.launchpad.net/bugs/1638153

 src/core/group.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/core/group.c b/src/core/group.c
index 9280384..a3f4f88 100644
--- a/src/core/group.c
+++ b/src/core/group.c
@@ -45,10 +45,15 @@ meta_group_new (MetaDisplay *display,
   group->group_leader = group_leader;
   group->refcount = 1; /* owned by caller, hash table has only weak ref */
 
+  gdk_error_trap_push ();
+
   XGetWindowAttributes (display->xdisplay, group_leader, &attrs);
   XSelectInput (display->xdisplay, group_leader,
                 attrs.your_event_mask | PropertyChangeMask);
 
+  if (gdk_error_trap_pop () != 0)
+    return NULL;
+
   if (display->groups_by_leader == NULL)
     display->groups_by_leader = g_hash_table_new (meta_unsigned_long_hash,
                                                   meta_unsigned_long_equal);
@@ -162,12 +167,14 @@ meta_window_compute_group (MetaWindow* window)
       window->group = group;
     }
 
+  if (!window->group)
+    return;
+
   window->group->windows = g_slist_prepend (window->group->windows, window);
 
   meta_topic (META_DEBUG_GROUPS,
               "Adding %s to group with leader 0x%lx\n",
               window->desc, group->group_leader);
-
 }
 
 static void
@@ -273,5 +280,4 @@ meta_group_property_notify (MetaGroup  *group,
                               event->xproperty.atom);
 
   return TRUE;
-
 }


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