From cb4926026f1f05ffd44af0a9ab51c01f1bfdf21c Mon Sep 17 00:00:00 2001
From: Not Zed <NotZed@Ximian.com>
Date: Tue, 24 Jul 2001 01:36:11 +0000
Subject: Go back to calling mail_msg_free here. (mail_msg_destroy): Remove the

2001-07-23  Not Zed  <NotZed@Ximian.com>

        * mail-mt.c (mail_msgport_replied): Go back to calling
        mail_msg_free here.
        (mail_msg_destroy): Remove the operation unregistration stuff.
        (mail_msg_received): And put it here, so we unregister as soon as
        the async part of the operation is complete.  I thought about this
        and we should be doing this anyway so we register/unregister
        always in the same thread, although the camel_operation api
        doesn't enforce it, this *is* what it expects.

        * message-list.c (regen_list_regen): re-add reporting to
        rebuilding the message list.  Basically fixes #4931

svn path=/trunk/; revision=11332
---
 mail/ChangeLog      | 14 ++++++++++++++
 mail/mail-mt.c      | 12 ++++++------
 mail/message-list.c | 13 +++++++++++--
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/mail/ChangeLog b/mail/ChangeLog
index 7aea0c7a21..9bdd6d60da 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2001-07-23  Not Zed  <NotZed@Ximian.com>
+
+	* mail-mt.c (mail_msgport_replied): Go back to calling
+	mail_msg_free here.
+	(mail_msg_destroy): Remove the operation unregistration stuff.
+	(mail_msg_received): And put it here, so we unregister as soon as
+	the async part of the operation is complete.  I thought about this
+	and we should be doing this anyway so we register/unregister
+	always in the same thread, although the camel_operation api
+	doesn't enforce it, this *is* what it expects.
+
+	* message-list.c (regen_list_regen): re-add reporting to
+	rebuilding the message list.  Basically fixes #4931
+
 2001-07-23  Jeffrey Stedfast  <fejj@ximian.com>
 
 	* mail-search.c (toggled_fwd_cb): Oops. Uncomment this code since
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index da004630f7..7dc47a37bc 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -259,7 +259,7 @@ mail_msgport_replied(GIOChannel *source, GIOCondition cond, void *d)
 		if (m->ops->reply_msg)
 			m->ops->reply_msg(m);
 		mail_msg_check_error(m);
-		mail_msg_destroy(NULL, m, NULL);
+		mail_msg_free(m);
 	}
 
 	return TRUE;
@@ -303,11 +303,6 @@ mail_msg_destroy(EThread *e, EMsg *msg, void *data)
 	checkmem(m->priv);
 #endif	
 
-	if (m->ops->describe_msg) {
-		camel_operation_end(m->cancel);
-		camel_operation_unregister(m->cancel);
-	}
-
 	mail_msg_free(m);
 }
 
@@ -336,6 +331,11 @@ mail_msg_received(EThread *e, EMsg *msg, void *data)
 		m->ops->receive_msg(m);
 		mail_disable_stop();
 	}
+
+	if (m->ops->describe_msg) {
+		camel_operation_end(m->cancel);
+		camel_operation_unregister(m->cancel);
+	}
 }
 
 static void mail_msg_cleanup(void)
diff --git a/mail/message-list.c b/mail/message-list.c
index ffa922590a..581452e99c 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2285,14 +2285,20 @@ regen_list_regen (struct _mail_msg *mm)
 	GPtrArray *uids, *uidnew, *showuids;
 	CamelMessageInfo *info;
 	int i;
-	
+
+	camel_operation_register(mm->cancel);
+	camel_operation_start(mm->cancel, _("Updating message list"));
+
 	if (m->search)
 		uids = camel_folder_search_by_expression (m->folder, m->search, &mm->ex);
 	else
 		uids = camel_folder_get_uids (m->folder);
 	
-	if (camel_exception_is_set (&mm->ex))
+	if (camel_exception_is_set (&mm->ex)) {
+		camel_operation_end(mm->cancel);
+		camel_operation_unregister(mm->cancel);
 		return;
+	}
 	
 	/* perform hiding */
 	if (m->hideexpr) {
@@ -2395,6 +2401,9 @@ regen_list_regen (struct _mail_msg *mm)
 		m->tree = camel_folder_thread_messages_new_summary (m->summary);
 	else
 		m->tree = NULL;
+
+	camel_operation_end(mm->cancel);
+	camel_operation_unregister(mm->cancel);
 }
 
 static void
-- 
cgit v1.2.3