[evolution-patches] fix for bug #43862
- From: Jeffrey Stedfast <fejj ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] fix for bug #43862
- Date: 30 May 2003 17:16:29 -0400
This only ever happens the first time you run Evolution and if you add
an IMAP server as your first account.
The problem is that there is a race condition between the session going
online, the stores going online, and the stores getting 'noted' causing
a get_folderinfo
it seems that most of the time, the new imap account is in OFFLINE mode
in mail_note_store() and so mail_get_folderinfo() never gets called for
it.
The attached patch seems to fix it for me, but I'm not sure if it is the
best solution or if it introduces other race conditions? (note that I
now add a 'struct _store_info' pointer to 'struct _update_data', there
may be a race caused by that - not really sure. Actually, hmm... looks
like there definetely is.
what I've done is move the mail_set_offline() async function call out of
mail-offline-handler.c:storage_go_online() and into mail_note_store()
instead, only getting called if the DiscoStore is in offline mode while
the CamelSession is in online mode.
This patch still needs work (ugh, introduces another race) but at least
it documents what the problem in 43862...
--
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2740
diff -u -r1.2740 ChangeLog
--- ChangeLog 30 May 2003 18:27:02 -0000 1.2740
+++ ChangeLog 30 May 2003 20:37:37 -0000
@@ -1,3 +1,56 @@
+2003-05-30 Jeffrey Stedfast <fejj ximian com>
+
+ * mail-folder-cache.c (mail_note_store): If the session is
+ 'online' and we are noting a CamelDiscoStore, make sure that it is
+ changed to online status before calling mail_get_folderinfo().
+
+ * mail-offline-handler.c (storage_go_online): Don't call
+ mail_store_set_offline() here, instead move it into
+ mail_note_store().
+
+2003-05-30 Jeffrey Stedfast <fejj ximian com>
+
+ * mail-local.c (load_metainfo): Stat the XML file before trying to
+ parse it to make sure it exists.
+
+2003-05-21 Jeffrey Stedfast <fejj ximian com>
+
+ * mail-account-gui.c (sig_add_new_signature): Unref the gconf client.
+
+ * folder-browser.c (save_cursor_pos): Unref the gconf client after
+ using it.
+ (folder_browser_set_message_preview): Same.
+ (folder_browser_toggle_preview): Here too.
+ (folder_browser_toggle_threads): And here.
+ (folder_browser_toggle_hide_deleted): Here as well.
+ (folder_browser_set_message_display_style): And here.
+ (fb_resize_cb): Here.
+ (paned_realised): And here.
+ (done_message_selected): And everywhere.
+
+ * folder-browser-ui.c (folder_browser_ui_add_message): Unref the
+ gconf client when we're finished with it.
+ (folder_browser_ui_add_list): Same.
+ (folder_browser_ui_add_global): Here too.
+
+ * component-factory.c (owner_unset_cb): Unref the gconf client
+ when we're finished with it.
+
+ * mail-config.c (mail_config_write_on_exit): On exit, free our
+ objects and such.
+
+ * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Unref the
+ gconf client when we're finished with it.
+ (ask_confirm_for_empty_subject): Same.
+ (ask_confirm_for_only_bcc): Here too.
+ (composer_get_message): And here.
+ (create_msg_composer): Here too.
+ (mail_generate_reply): And here.
+ (forward): Same here.
+ (transfer_msg_done): And here too.
+ (delete_msg): And here.
+ (confirm_expunge): Here too.
+
2003-05-30 Radek Doulik <rodo ximian com>
* mail-config.c (config_write_style): use %02x instead of %2x when
Index: mail-offline-handler.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-offline-handler.c,v
retrieving revision 1.12
diff -u -r1.12 mail-offline-handler.c
--- mail-offline-handler.c 16 May 2003 18:52:14 -0000 1.12
+++ mail-offline-handler.c 30 May 2003 20:37:37 -0000
@@ -269,7 +269,6 @@
CamelStore *store = key;
if (service_is_relevant (CAMEL_SERVICE (store), FALSE)) {
- mail_store_set_offline (store, FALSE, NULL, NULL);
mail_note_store (store, NULL, CORBA_OBJECT_NIL,
NULL, NULL);
}
@@ -284,7 +283,7 @@
offline_handler = MAIL_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
priv = offline_handler->priv;
-
+
/* Enable auto-mail-checking */
camel_session_set_online (session, TRUE);
Index: mail-folder-cache.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-folder-cache.c,v
retrieving revision 1.68
diff -u -r1.68 mail-folder-cache.c
--- mail-folder-cache.c 12 Nov 2002 14:59:34 -0000 1.68
+++ mail-folder-cache.c 30 May 2003 20:37:38 -0000
@@ -42,6 +42,7 @@
#include "mail-mt.h"
#include "mail-folder-cache.h"
#include "mail-ops.h"
+#include "mail-session.h"
/* For notifications of changes */
#include "mail-vfolder.h"
@@ -640,6 +641,8 @@
struct _update_data {
struct _update_data *next;
struct _update_data *prev;
+
+ struct _store_info *si;
int id; /* id for cancellation */
@@ -799,6 +802,18 @@
return TRUE;
}
+static void
+store_online_cb (CamelStore *store, void *data)
+{
+ struct _update_data *ud = data;
+
+ LOCK(info_lock);
+ ud->id = mail_get_folderinfo(store, update_folders, ud);
+
+ e_dlist_addtail(&ud->si->folderinfo_updates, (EDListNode *)ud);
+ UNLOCK(info_lock);
+}
+
void
mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage,
void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data)
@@ -848,8 +863,44 @@
camel_object_hook_event(store, "folder_subscribed", store_folder_subscribed, NULL);
camel_object_hook_event(store, "folder_unsubscribed", store_folder_unsubscribed, NULL);
}
-
-
+
+ if (!CAMEL_IS_DISCO_STORE (store)) {
+ ud = g_malloc (sizeof (*ud));
+ ud->done = done;
+ ud->data = data;
+ ud->id = mail_get_folderinfo (store, update_folders, ud);
+
+ e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud);
+ } else {
+ if (camel_session_is_online (session)) {
+ if (camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) {
+ /* go online first, and then get_folderinfo */
+ ud = g_malloc(sizeof(*ud));
+ ud->done = done;
+ ud->data = data;
+ ud->si = si;
+ ud->id = 0;
+
+ mail_store_set_offline (store, FALSE, store_online_cb, ud);
+ } else {
+ ud = g_malloc (sizeof (*ud));
+ ud->done = done;
+ ud->data = data;
+ ud->id = mail_get_folderinfo (store, update_folders, ud);
+
+ e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud);
+ }
+ } else if (camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (store))) {
+ ud = g_malloc (sizeof (*ud));
+ ud->done = done;
+ ud->data = data;
+ ud->id = mail_get_folderinfo (store, update_folders, ud);
+
+ e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud);
+ }
+ }
+
+#if 0
if (!CAMEL_IS_DISCO_STORE (store) ||
camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_ONLINE ||
camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (store))) {
@@ -860,6 +911,7 @@
e_dlist_addtail(&si->folderinfo_updates, (EDListNode *)ud);
}
+#endif
UNLOCK(info_lock);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]