aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-01-28 17:04:28 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-01-28 17:04:28 +0800
commit29620d17ab079c70a475af56f4e7e7cbe09b59cc (patch)
tree1aefeaae35cfe8e0c008e7ddfd56223d87f94373 /mail
parent7d76d9858a79a758acbadff96417018d0b9a13d8 (diff)
downloadgsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar
gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar.gz
gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar.bz2
gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar.lz
gsoc2013-evolution-29620d17ab079c70a475af56f4e7e7cbe09b59cc.tar.xz
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')
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/mail-component.c2
-rw-r--r--mail/mail-vfolder.c18
3 files changed, 27 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9637217f5d..6ea67b7a2d 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+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.
+
2005-01-27 Rodney Dawes <dobey@novell.com>
* mail-config.glade: Fix the labels in the account druid to be
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 7608fe4f84..e5b96aa7cf 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -649,6 +649,8 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
int now = time(NULL)/60/60/24, days;
GConfClient *gconf = mail_config_get_gconf_client();
+ mail_vfolder_shutdown();
+
mc->priv->quit_expunge = gconf_client_get_bool(gconf, "/apps/evolution/mail/trash/empty_on_exit", NULL)
&& ((days = gconf_client_get_int(gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL)) == 0
|| (days + gconf_client_get_int(gconf, "/apps/evolution/mail/trash/empty_date", NULL)) <= now);
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;