aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-message-cache.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-07-03 23:24:55 +0800
committerDan Winship <danw@src.gnome.org>2001-07-03 23:24:55 +0800
commit8e7eea0d261f38e22c72a9a394df6375247c8e59 (patch)
tree36aa662db902d53cc99f10e3977d0c0c6ad0d4f0 /camel/providers/imap/camel-imap-message-cache.c
parent4834cba289487632097ab77228d9abf4e7eb2f90 (diff)
downloadgsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.tar
gsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.tar.gz
gsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.tar.bz2
gsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.tar.lz
gsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.tar.xz
gsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.tar.zst
gsoc2013-evolution-8e7eea0d261f38e22c72a9a394df6375247c8e59.zip
Doh. Don't remove things from the hash table while foreach'ing it. (And
* providers/imap/camel-imap-message-cache.c (camel_imap_message_cache_clear): Doh. Don't remove things from the hash table while foreach'ing it. (And can't use foreach_remove either because we have to remove them in a weird order). Fixes #3618. * providers/imap/camel-imap-folder.c (imap_get_message): If the server returns OK from the FETCH BODY, but there's no parseable BODY response, it's probably because there's an UN-parseable BODY response, implying the message is badly formatted, MIMEwise. In that case, fall back to fetching the message as a single part. svn path=/trunk/; revision=10748
Diffstat (limited to 'camel/providers/imap/camel-imap-message-cache.c')
-rw-r--r--camel/providers/imap/camel-imap-message-cache.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/camel/providers/imap/camel-imap-message-cache.c b/camel/providers/imap/camel-imap-message-cache.c
index 2f811eea47..d4f569423c 100644
--- a/camel/providers/imap/camel-imap-message-cache.c
+++ b/camel/providers/imap/camel-imap-message-cache.c
@@ -421,12 +421,11 @@ camel_imap_message_cache_remove (CamelImapMessageCache *cache, const char *uid)
g_ptr_array_free (subparts, TRUE);
}
-static gboolean
-clear_part (gpointer key, gpointer value, gpointer data)
+static void
+add_uids (gpointer key, gpointer value, gpointer data)
{
if (!strchr (key, '.'))
- camel_imap_message_cache_remove (data, key);
- return TRUE;
+ g_ptr_array_add (data, key);
}
/**
@@ -438,7 +437,15 @@ clear_part (gpointer key, gpointer value, gpointer data)
void
camel_imap_message_cache_clear (CamelImapMessageCache *cache)
{
- g_hash_table_foreach_remove (cache->parts, clear_part, cache);
+ GPtrArray *uids;
+ int i;
+
+ uids = g_ptr_array_new ();
+ g_hash_table_foreach (cache->parts, add_uids, uids);
+
+ for (i = 0; i < uids->len; i++)
+ camel_imap_message_cache_remove (cache, uids->pdata[i]);
+ g_ptr_array_free (uids, TRUE);
}