[gthumb] preloader: make sure the cache size is below the max



commit 50eeb1a592dcaa3b7d30061f37d2da57cd9a03b9
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Apr 3 19:24:50 2017 +0200

    preloader: make sure the cache size is below the max

 gthumb/gth-image-preloader.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-image-preloader.c b/gthumb/gth-image-preloader.c
index 8768e21..607bb46 100644
--- a/gthumb/gth-image-preloader.c
+++ b/gthumb/gth-image-preloader.c
@@ -461,7 +461,7 @@ static void
 _gth_image_preloader_add_to_cache (GthImagePreloader *self,
                                   CacheData         *cache_data)
 {
-       if (g_queue_get_length (self->priv->cache) > CACHE_MAX_SIZE) {
+       while (g_queue_get_length (self->priv->cache) >= CACHE_MAX_SIZE) {
                CacheData *oldest = g_queue_pop_tail (self->priv->cache);
                cache_data_unref (oldest);
        }


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