GNOME Bugzilla – Bug 325208
reopening an email draft crashes composer due to invalid account name
Last modified: 2008-11-13 11:37:50 UTC
I don't know how exactly how managed to create the drafts this way, but I have several emails in my Drafts folder with X-Evolution-Account: 1120811084.728.0@debian in the header. They might have been created with Evolution 2.4 on Ubuntu Hoary and then copied over via rsync to my current machine, running a self-compiled Evolution 2.4.2 with Garnome 2.12.2. When opening one of the email with the invalid/unknown account infos, Evolution segfaults in e-msg-composer.c, line 4217: if (account_name) { account_name = g_strdup (account_name); g_strstrip (account_name); if ((account = mail_config_get_account_by_uid(account_name)) == NULL) /* 'old' setting */ account = mail_config_get_account_by_name(account_name); g_free (account_name); 4217 => account_name = g_strdup (account->name); } The reason is that account is NULL. I checked it manually in a debugger, neither of the two calls to set it return a value. I assume that the account UID is no longer valid. As I said earlier, I don't know exactly how I managed this, but I suppose one can reproduce it in several ways: - delete an email account and create another one - copy a draft folder from one machine to another - migrate from one Evolution to another The solution to the problem is simple, just change account_name = g_strdup (account->name); into account_name = account ? g_strdup (account->name) : NULL; I checked the latest revision (1.526), the problem still exists there. I verified that the suggested change causes no problems in a debugger: account_name is only used in a call to e_msg_composer_set_headers() and that seems to work just fine with a NULL parameter. For the record (and please don't ask me for a gdb backtrace of all threads, I don't think it is necessary and I don't have Evolution running inside gdb), here's the stack backtrace: C e_msg_composer_new_with_message, FP=bfffcb88 C edit_message, FP=bfffcba8 C edit_messages, FP=bfffcbd8 C get_messages_got, FP=bfffcbf8 C mail_msgport_replied, FP=bfffcc28 C g_io_unix_dispatch, FP=bfffcc58 C g_main_dispatch, FP=bfffcca8 C g_main_context_dispatch, FP=bfffccd8 C g_main_context_iterate, FP=bfffcd48 C g_main_loop_run, FP=bfffcd88 C bonobo_main, FP=bfffcda8 C main, FP=bfffcee8 __libc_start_main, FP=bfffcf08
still in 2.6
Patrick, can you please verify in current stable 2.24.1, TIA
The logic now reads: if (account_name) { account_name = g_strdup (account_name); g_strstrip (account_name); if ((account = mail_config_get_account_by_uid (account_name)) == NULL) /* 'old' setting */ account = mail_config_get_account_by_name (account_name); if (account) { g_free (account_name); account_name = g_strdup (account->name); } } That second "if (account)" should prevent the crash Patrick encountered. I traced the change back to bug #322863, so I'm closing this as a duplicate. *** This bug has been marked as a duplicate of 322863 ***