Fix clearing local images from litehtml cache

The cache clearing logic was double incrementing for cid: images, going
into an infinite loop if a cid: image was the last one checked
This commit is contained in:
Jonathan Boeing 2021-08-07 21:32:28 -07:00
parent 481897fc2a
commit 10349d5e49

View file

@ -229,11 +229,13 @@ gint container_linux::clear_images(gsize desired_size)
lock_images_cache();
/* First, remove all local images - the ones with "cid:" URL. */
for (auto i = m_images.begin(); i != m_images.end(); ++i) {
for (auto i = m_images.begin(); i != m_images.end(); ) {
if (!strncmp(i->first.c_str(), "cid:", 4)) {
g_object_unref(i->second.first);
i = m_images.erase(i);
num++;
} else {
++i;
}
}