aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-26 23:47:08 +0800
committerDan Winship <danw@src.gnome.org>2001-03-26 23:47:08 +0800
commit91e0ec52dfbf24a381fe1fdabd05338b10c17ed2 (patch)
tree1b74d959e0314815ace66e25d265bef0e653b763 /mail/mail-format.c
parentc92c8b1fe42d8b4aa229b6be0172844a9a4a8bee (diff)
downloadgsoc2013-evolution-91e0ec52dfbf24a381fe1fdabd05338b10c17ed2.tar.gz
gsoc2013-evolution-91e0ec52dfbf24a381fe1fdabd05338b10c17ed2.tar.zst
gsoc2013-evolution-91e0ec52dfbf24a381fe1fdabd05338b10c17ed2.zip
Make fake content-id URLs be guaranteed unique: the old way (with %p on
* mail-format.c (get_cid): Make fake content-id URLs be guaranteed unique: the old way (with %p on the CamelMimePart *) would generate duplicates if memory was freed and re-allocated the right way. * mail-display.c (pixbuf_gen_idle, etc): Make the thumbnail cache global rather than per-MailDisplay, since content-ids ought to be globally unique. Also, don't leak content-id strings when the pixbuf generation fails, and remove pixbufs from the cache after 5 minutes. svn path=/trunk/; revision=8944
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 4957d01c27..f6a145294e 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -179,17 +179,18 @@ get_cid (CamelMimePart *part, MailDisplay *md)
GHashTable *urls;
char *cid;
gpointer orig_name, value;
+ static int fake_cid_counter = 0;
urls = g_datalist_get_data (md->data, "urls");
/* If we have a real Content-ID, use it. If we don't,
- * make a (syntactically invalid) fake one.
+ * make a (syntactically invalid, unique) fake one.
*/
if (camel_mime_part_get_content_id (part)) {
cid = g_strdup_printf ("cid:%s",
camel_mime_part_get_content_id (part));
} else
- cid = g_strdup_printf ("cid:@@@%p", part);
+ cid = g_strdup_printf ("cid:@@@%d", fake_cid_counter++);
if (g_hash_table_lookup_extended (urls, cid, &orig_name, &value)) {
g_free (cid);