[Xfce4-commits] <ristretto:master> Free EXIF data Improve cache-size calculation
Stephan Arts
stephan at xfce.org
Wed Aug 12 12:20:35 CEST 2009
Updating branch refs/heads/master
to d67206b1dc62557daf8e26033102a928f3957622 (commit)
from cb5053d9d63db53016fd7d0b7873c4231a8280b2 (commit)
commit d67206b1dc62557daf8e26033102a928f3957622
Author: Stephan Arts <stephan at xfce.org>
Date: Mon Jun 15 20:41:50 2009 +0200
Free EXIF data
Improve cache-size calculation
src/image.c | 6 ++++++
src/image_cache.c | 5 ++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/image.c b/src/image.c
index ecc8d07..9a8c850 100644
--- a/src/image.c
+++ b/src/image.c
@@ -212,6 +212,12 @@ rstto_image_dispose (GObject *object)
g_free (image->priv->buffer);
image->priv->buffer = NULL;
}
+
+ if (image->priv->exif_data)
+ {
+ exif_data_free (image->priv->exif_data);
+ image->priv->exif_data = NULL;
+ }
}
diff --git a/src/image_cache.c b/src/image_cache.c
index 5eb9451..00c4dc3 100644
--- a/src/image_cache.c
+++ b/src/image_cache.c
@@ -140,8 +140,10 @@ 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*1000000))
{
+ g_debug("Unload: %d", rstto_image_get_size (c_image));
rstto_image_unload (c_image);
cache->cache_list = g_list_remove (cache->cache_list, c_image);
g_object_unref (c_image);
@@ -150,9 +152,9 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea
}
else
{
- size += rstto_image_get_size (c_image);
if (rstto_image_get_size (c_image) == 0)
{
+ g_debug("Unload: %d", rstto_image_get_size (c_image));
rstto_image_unload (c_image);
cache->cache_list = g_list_remove (cache->cache_list, c_image);
g_object_unref (c_image);
@@ -160,6 +162,7 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea
}
}
}
+ g_debug ("CacheSize: %f%%\t %d:%d", ((gdouble)size/((gdouble)cache_size*1000000))*100, size, cache_size*1000000);
}
g_object_unref (settings);
return retval;
More information about the Xfce4-commits
mailing list