[gtk+] pixelcache: Add a warning for an invariant that shouldn't happen



commit 9b29a7a7008f5607f92117a887d24d3bdafe92b3
Author: Benjamin Otte <otte redhat com>
Date:   Thu Apr 10 01:53:57 2014 +0200

    pixelcache: Add a warning for an invariant that shouldn't happen
    
    Pixel caches should be unmapped before being freed and unmapping clears
    those variables.

 gtk/gtkpixelcache.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c
index 339518b..4ab8bb9 100644
--- a/gtk/gtkpixelcache.c
+++ b/gtk/gtkpixelcache.c
@@ -69,6 +69,14 @@ _gtk_pixel_cache_free (GtkPixelCache *cache)
   if (cache == NULL)
     return;
 
+  if (cache->timeout_tag ||
+      cache->surface ||
+      cache->surface_dirty)
+    {
+      g_warning ("pixel cache freed that wasn't unmapped: tag %u surface %p sirty %p",
+                 cache->timeout_tag, cache->surface, cache->surface_dirty);
+    }
+
   if (cache->timeout_tag)
     g_source_remove (cache->timeout_tag);
 


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