Updating branch refs/heads/ristretto-0.0 to e47e53b62d95d969276956fb50a659b99cb6738a (commit) from b53ef99302afe9424dc1f8424e0c896034f3069c (commit)
commit e47e53b62d95d969276956fb50a659b99cb6738a Author: Stephan Arts <step...@xfce.org> Date: Sat May 2 16:19:18 2009 +0200 Improve cache behaviour ChangeLog | 9 +++++++++ src/image.c | 2 +- src/image.h | 2 +- src/image_cache.c | 15 ++++++++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b913bf5..40e656d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-05-02 Stephan Arts <step...@xfce.org> + * src/image_cache.c: Remove images which return size=0 from the cache, + it might still be loading, in which case it should stop immediately and + be dropped from the cache + * src/image.c + src/image.h + src/image_cache.c: calculate cache-size in uint instead of uint64 + +2009-05-02 Stephan Arts <step...@xfce.org> + * src/main_window.c src/main_window_ui.xml: Implement save-as function (Bug #4647) * src/navigator.c: Fix iter_find_image function diff --git a/src/image.c b/src/image.c index 9c53043..5a44844 100644 --- a/src/image.c +++ b/src/image.c @@ -792,7 +792,7 @@ cb_rstto_image_update(RsttoImage *image) return TRUE; } -guint64 +guint rstto_image_get_size (RsttoImage *image) { GdkPixbuf *pixbuf = rstto_image_get_pixbuf (image); diff --git a/src/image.h b/src/image.h index a7866ea..05b0846 100644 --- a/src/image.h +++ b/src/image.h @@ -88,7 +88,7 @@ rstto_image_pop_transformation (RsttoImage *image, GError **error); /* Should only be used by image-transformation implementations */ void rstto_image_set_pixbuf (RsttoImage *image, GdkPixbuf *pixbuf); -guint64 rstto_image_get_size (RsttoImage *image); +guint rstto_image_get_size (RsttoImage *image); G_END_DECLS diff --git a/src/image_cache.c b/src/image_cache.c index 46d7220..c548be6 100644 --- a/src/image_cache.c +++ b/src/image_cache.c @@ -92,8 +92,8 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea gboolean retval = FALSE; RsttoSettings *settings = rstto_settings_new(); GValue val = {0, }, val_cache_size = {0, }; - guint64 size = 0; - guint64 cache_size = 0; + guint size = 0; + guint cache_size = 0; RsttoImage *c_image; GList *iter = NULL; @@ -141,7 +141,6 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea for (iter = cache->cache_list->next; iter != NULL; iter = g_list_next (iter)) { c_image = iter->data; - size += rstto_image_get_size (c_image); if (size > cache_size) { rstto_image_unload (c_image); @@ -149,6 +148,16 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea iter = g_list_previous(iter); retval = TRUE; } + else + { + size += rstto_image_get_size (c_image); + if (rstto_image_get_size (c_image) == 0) + { + rstto_image_unload (c_image); + cache->cache_list = g_list_remove (cache->cache_list, c_image); + iter = g_list_previous(iter); + } + } } } g_value_unset (&val); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits