From 26fccb498293b89b9bef804fc85436e00a4ee1cd Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 28 Nov 2000 02:10:55 +0000 Subject: This needs to run from the main thread, not the camel thread, so add a * mail-local.c (local_folder_changed): This needs to run from the main thread, not the camel thread, so add a proxy signal handler to call mail_op_forward_event. Fixes hangs (eg bugzilla #909). svn path=/trunk/; revision=6687 --- mail/ChangeLog | 6 ++++++ mail/mail-local.c | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 75fe25210f..d7b1bc3179 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2000-11-27 Dan Winship + + * mail-local.c (local_folder_changed): This needs to run from the + main thread, not the camel thread, so add a proxy signal handler + to call mail_op_forward_event. Fixes hangs (eg bugzilla #909). + 2000-11-27 Jeffrey Stedfast * mail-display.c: Removed some unecessary debugging printf's diff --git a/mail/mail-local.c b/mail/mail-local.c index 6b1359e73c..666cfefbbd 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -623,12 +623,10 @@ static void local_folder_changed (CamelObject *object, gpointer event_data, gpointer user_data) { - CamelFolder *folder = CAMEL_FOLDER (object); MailLocalFolder *local_folder = user_data; - int unread; + int unread = GPOINTER_TO_INT (event_data); char *display; - unread = camel_folder_get_unread_message_count (folder); if (unread != local_folder->last_unread) { CORBA_Environment ev; @@ -652,6 +650,18 @@ local_folder_changed (CamelObject *object, gpointer event_data, } } +static void +local_folder_changed_proxy (CamelObject *object, gpointer event_data, + gpointer user_data) +{ + CamelFolder *folder = CAMEL_FOLDER (object); + int unread; + + unread = camel_folder_get_unread_message_count (folder); + mail_op_forward_event (local_folder_changed, object, + GINT_TO_POINTER (unread), user_data); +} + static char * describe_register_folder (gpointer in_data, gboolean gerund) { @@ -686,6 +696,8 @@ do_register_folder (gpointer in_data, gpointer op_data, CamelException *ex) if (meta->indexed) flags |= CAMEL_STORE_FOLDER_BODY_INDEX; local_folder->folder = camel_store_get_folder (store, meta->name, flags, ex); + local_folder->last_unread = camel_folder_get_unread_message_count ( + local_folder->folder); camel_object_unref (CAMEL_OBJECT (store)); free_metainfo (meta); } @@ -704,10 +716,9 @@ cleanup_register_folder (gpointer in_data, gpointer op_data, g_hash_table_insert (local_folder->local_store->folders, local_folder->name, local_folder->folder); local_folder->name = strrchr (local_folder->path, '/') + 1; - local_folder->last_unread = 0; camel_object_hook_event (CAMEL_OBJECT (local_folder->folder), - "folder_changed", local_folder_changed, + "folder_changed", local_folder_changed_proxy, local_folder); local_folder_changed (CAMEL_OBJECT (local_folder->folder), NULL, local_folder); -- cgit