diff options
author | Not Zed <NotZed@Ximian.com> | 2005-01-28 17:04:28 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-01-28 17:04:28 +0800 |
commit | 29620d17ab079c70a475af56f4e7e7cbe09b59cc (patch) | |
tree | 1aefeaae35cfe8e0c008e7ddfd56223d87f94373 /mail/mail-vfolder.c | |
parent | 7d76d9858a79a758acbadff96417018d0b9a13d8 (diff) | |
download | gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar.gz gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar.zst gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.zip |
See bug #69815.
2005-01-27 Not Zed <NotZed@Ximian.com>
* See bug #69815.
* mail-component.c (impl_quit): shutdown vfolders as first step.
* mail-vfolder.c (vfolder_setup_do): if we're shutdown during
processing, just noop.
(vfolder_adduri_do): same.
(mail_vfolder_shutdown): set the shutdown flag.
svn path=/trunk/; revision=28592
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r-- | mail/mail-vfolder.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index bbb839eb9a..a1a0830ac0 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -59,6 +59,9 @@ static pthread_mutex_t vfolder_lock = PTHREAD_MUTEX_INITIALIZER; static GList *source_folders_remote; /* list of source folder uri's - remote ones */ static GList *source_folders_local; /* list of source folder uri's - local ones */ static GHashTable *vfolder_hash; +/* This is a slightly hacky solution to shutting down, we poll this variable in various + loops, and just quit processing if it is set. */ +static volatile int shutdown; /* are we shutting down? */ /* more globals ... */ extern CamelSession *session; @@ -99,7 +102,7 @@ vfolder_setup_do(struct _mail_msg *mm) camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query); l = m->sources_uri; - while (l) { + while (l && !shutdown) { d(printf(" Adding uri: %s\n", (char *)l->data)); folder = mail_tool_uri_to_folder (l->data, 0, &mm->ex); if (folder) { @@ -112,14 +115,15 @@ vfolder_setup_do(struct _mail_msg *mm) } l = m->sources_folder; - while (l) { + while (l && !shutdown) { d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name)); camel_object_ref(l->data); list = g_list_append(list, l->data); l = l->next; } - camel_vee_folder_set_folders((CamelVeeFolder *)m->folder, list); + if (!shutdown) + camel_vee_folder_set_folders((CamelVeeFolder *)m->folder, list); l = list; while (l) { @@ -251,9 +255,13 @@ vfolder_adduri_do(struct _mail_msg *mm) GList *l; CamelFolder *folder = NULL; + if (shutdown) + return; + d(printf("%s uri to vfolder: %s\n", m->remove?"Removing":"Adding", m->uri)); /* we dont try lookup the cache if we are removing it, its no longer there */ + if (!m->remove && !mail_note_get_folder_from_uri(m->uri, &folder)) { g_warning("Folder '%s' disappeared while I was adding/remove it to/from my vfolder", m->uri); return; @@ -264,7 +272,7 @@ vfolder_adduri_do(struct _mail_msg *mm) if (folder != NULL) { l = m->folders; - while (l) { + while (l && !shutdown) { if (m->remove) camel_vee_folder_remove_folder((CamelVeeFolder *)l->data, folder); else @@ -1126,6 +1134,8 @@ vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data) void mail_vfolder_shutdown (void) { + shutdown = 1; + g_hash_table_foreach (vfolder_hash, vfolder_foreach_cb, NULL); g_hash_table_destroy (vfolder_hash); vfolder_hash = NULL; |