[gegl] Drop sampler tile if it's trimmed from the cache



commit 90be63a6e1ba89f89e14cda0b9503141459a7194
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Wed Oct 9 01:42:08 2013 -0700

    Drop sampler tile if it's trimmed from the cache
    
    Otherwise the sampler will end up seeing a different
    tile than buffer_get().

 gegl/buffer/gegl-tile-handler-cache.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index 8dbfc1e..e97b43d 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -436,10 +436,19 @@ gegl_tile_handler_cache_trim (GeglTileHandlerCache *cache)
   if (link != NULL)
     {
       CacheItem *last_writable = LINK_GET_ITEM (link);
+      GeglTile *tile = last_writable->tile;
+      GeglTileStorage *storage = tile->tile_storage;
 
       g_hash_table_remove (cache_ht, last_writable);
-      cache_total  -= last_writable->tile->size;
-      gegl_tile_unref (last_writable->tile);
+      cache_total -= tile->size;
+
+      if (storage && storage->hot_tile == tile)
+        {
+          storage->hot_tile = NULL;
+          gegl_tile_unref (tile);
+        }
+
+      gegl_tile_unref (tile);
       g_slice_free (CacheItem, last_writable);
       return TRUE;
     }


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