From 91e0ec52dfbf24a381fe1fdabd05338b10c17ed2 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 26 Mar 2001 15:47:08 +0000 Subject: 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 --- mail/mail-format.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mail/mail-format.c') 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); -- cgit v1.2.3