commit 6dc279d931599fa2c7be4b3cd49273625008d7a5
parent 531b117a0a3459abf82022f032fa52a2d09c1695
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Sat, 9 Mar 2019 22:53:10 +0100
Always remove local images from Litehtml image cache
Since their "url" in cache only includes MIME
file name, they are not guaranteed to be unique
across different messages.
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/plugins/litehtml_viewer/container_linux_images.cpp b/src/plugins/litehtml_viewer/container_linux_images.cpp
@@ -214,7 +214,19 @@ gint container_linux::clear_images(gint desired_size)
lock_images_cache();
- /* First, tally up size of all the stored GdkPixbufs and
+ /* First, remove all local images - the ones with "cid:"
+ * URL. We will remove their list elements later. */
+ for (auto i = m_images.rbegin(); i != m_images.rend(); ++i) {
+ image *img = &(*i);
+
+ if (!strncmp(img->first.c_str(), "cid:", 4)) {
+ g_object_unref(img->second);
+ img->second = NULL;
+ num++;
+ }
+ }
+
+ /* Now tally up size of all the stored GdkPixbufs and
* deallocate those which make the total size be above
* the desired_size limit. We will remove their list
* elements later. */