[metacity] compositor: use only one error traps in free_win



commit 8fe2e48e8e05be1691edeea7e3844756ee60c903
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon May 30 15:32:10 2016 +0300

    compositor: use only one error traps in free_win
    
    free_win function already has two error traps, but there is other
    functions that could generate X errors. Replace existing traps with
    one that is added for whole function.

 src/compositor/compositor-xrender.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index d5fabc6..7df8fb5 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -1943,6 +1943,8 @@ free_win (MetaCompWindow *cw,
   Display *xdisplay = meta_display_get_xdisplay (display);
   MetaCompScreen *info = meta_screen_get_compositor_data (cw->screen);
 
+  meta_error_trap_push (display);
+
   /* See comment in map_win */
   if (cw->back_pixmap && destroy)
     {
@@ -1958,10 +1960,7 @@ free_win (MetaCompWindow *cw,
 
   if (cw->picture)
     {
-      meta_error_trap_push (display);
       XRenderFreePicture (xdisplay, cw->picture);
-      meta_error_trap_pop (display);
-
       cw->picture = None;
     }
 
@@ -2039,13 +2038,11 @@ free_win (MetaCompWindow *cw,
 
   if (destroy)
     {
-      if (cw->damage != None) {
-        meta_error_trap_push (display);
-        XDamageDestroy (xdisplay, cw->damage);
-        meta_error_trap_pop (display);
-
-        cw->damage = None;
-      }
+      if (cw->damage != None)
+        {
+          XDamageDestroy (xdisplay, cw->damage);
+          cw->damage = None;
+        }
 
       /* The window may not have been added to the list in this case,
          but we can check anyway */
@@ -2054,6 +2051,8 @@ free_win (MetaCompWindow *cw,
 
       g_free (cw);
     }
+
+  meta_error_trap_pop (display);
 }
 
 static void


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