[sapwood] improve the verbosity of the engine



commit e200cf3f34431116057b0f913d12d8201fc7eb55
Author: Sven Herzberg <herzi gnome-de org>
Date:   Fri Aug 6 13:18:53 2010 +0200

    improve the verbosity of the engine
    
    * engine/sapwood-pixmap.c: log the unref requests that get sent across
      the socket; do some cleanup in sapwood_pixmap_free() (diff -b for
      better readability)

 engine/sapwood-pixmap.c |   61 +++++++++++++++++++++++++---------------------
 1 files changed, 33 insertions(+), 28 deletions(-)
---
diff --git a/engine/sapwood-pixmap.c b/engine/sapwood-pixmap.c
index 62f8a94..9347bdd 100644
--- a/engine/sapwood-pixmap.c
+++ b/engine/sapwood-pixmap.c
@@ -20,6 +20,7 @@
  */
 #include <config.h>
 
+#include "sapwood-debug.h"
 #include "sapwood-pixmap-priv.h"
 #include "sapwood-proto.h"
 
@@ -136,7 +137,7 @@ sapwood_pixmap_get_for_file (const char *filename,
 	if (rep.pixmap[i][j])
 	  {
 	    gdk_error_trap_push ();
-	    pixmap = gdk_pixmap_foreign_new (rep.pixmap[i][j]);
+            pixmap = gdk_pixmap_foreign_new (rep.pixmap[i][j]);
             gdk_drawable_set_colormap (pixmap, gdk_screen_get_system_colormap (gdk_screen_get_default ()));
 
             if (sapwood_debug_xtraps)
@@ -155,7 +156,7 @@ sapwood_pixmap_get_for_file (const char *filename,
 	if (rep.pixmask[i][j])
 	  {
 	    gdk_error_trap_push ();
-	    pixmask = gdk_pixmap_foreign_new (rep.pixmask[i][j]);
+            pixmask = gdk_pixmap_foreign_new (rep.pixmask[i][j]);
 
             if (sapwood_debug_xtraps)
               gdk_flush ();
@@ -188,6 +189,8 @@ pixbuf_proto_unref_pixmap (guint32 id)
   PixbufCloseRequest  req;
   GError             *err = NULL;
 
+  LOG ("%s(): unref %d", G_STRFUNC, id);
+
   req.base.op     = PIXBUF_OP_CLOSE;
   req.base.length = sizeof(PixbufCloseRequest);
   req.id          = id;
@@ -202,34 +205,36 @@ pixbuf_proto_unref_pixmap (guint32 id)
 void
 sapwood_pixmap_free (SapwoodPixmap *self)
 {
-  if (self)
+  GdkDisplay *display = NULL;
+  int         i, j;
+
+  if (!self)
     {
-      GdkDisplay *display = NULL;
-      int         i, j;
+      return;
+    }
 
-      for (i = 0; i < 3; i++)
-	for (j = 0; j < 3; j++)
-	  if (self->pixmap[i][j])
-	    {
-	      if (!display)
-		display = gdk_drawable_get_display (self->pixmap[i][j]);
+  for (i = 0; i < 3; i++)
+    for (j = 0; j < 3; j++)
+      if (self->pixmap[i][j])
+        {
+          if (!display)
+            display = gdk_drawable_get_display (self->pixmap[i][j]);
 
-	      g_object_unref (self->pixmap[i][j]);
-	      if (self->pixmask[i][j])
-		g_object_unref (self->pixmask[i][j]);
+          g_object_unref (self->pixmap[i][j]);
+          if (self->pixmask[i][j])
+            g_object_unref (self->pixmask[i][j]);
 
-	      self->pixmap[i][j] = NULL;
-	      self->pixmask[i][j] = NULL;
-	    }
+          self->pixmap[i][j] = NULL;
+          self->pixmask[i][j] = NULL;
+        }
 
-      /* need to make sure all our operations are processed before the pixmaps
-       * are free'd by the server or we risk causing BadPixmap error */
-      if (display)
-	gdk_display_sync (display);
+  /* need to make sure all our operations are processed before the pixmaps
+   * are free'd by the server or we risk causing BadPixmap error */
+  if (display)
+    gdk_display_sync (display);
 
-      pixbuf_proto_unref_pixmap (self->id);
-      g_free (self);
-    }
+  pixbuf_proto_unref_pixmap (self->id);
+  g_free (self);
 }
 
 gboolean



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