Argh!!! Dont free the async op data here, the async op is still running

2001-10-30    <NotZed@Ximian.com>

        * subscribe-dialog.c (fe_cancel_op_foreach): Argh!!! Dont free the
        async op data here, the async op is still running and will access
        it!  Just try to cancel it and mark it as cancelled (id == -1)
        (fe_done_subscribing): Only remove outselves from the hash table
        if we're not cancelled.  The handle should always be set here,
        since this code runs in the gui thread.

        * message-list.c (on_cursor_activated_idle): If nothing
        selected/cursor not activated, then select no message.

        * mail-folder-cache.c (update_1folder): Make the trash count
        optional on EVOLUTION_COUNT_TRASH, becuase some lusers are just
        too stupid to understand what its for.

        * component-factory.c (storage_xfer_folder): Return slightly
        better error codes for copying folders, since its not implemented
        yet.

        * mail-vfolder.c, mail-local.c, mail-folder-cache.c,
        message-list.c component-factory.c, mail-ops.c,
        subscribe-dialog.c, mail-session.c: d() out some debug printfs,
        w() out some warnings.

        * folder-browser-ui.c (folder_browser_ui_add_message): Fix typo,
        Resent->Resend.

svn path=/trunk/; revision=14412
This commit is contained in:
0
2001-10-30 03:28:40 +00:00
committed by Michael Zucci
parent e01b1cb662
commit 093a00cf2b
10 changed files with 83 additions and 43 deletions

View File

@ -1,3 +1,31 @@
2001-10-30 <NotZed@Ximian.com>
* subscribe-dialog.c (fe_cancel_op_foreach): Argh!!! Dont free the
async op data here, the async op is still running and will access
it! Just try to cancel it and mark it as cancelled (id == -1)
(fe_done_subscribing): Only remove outselves from the hash table
if we're not cancelled. The handle should always be set here,
since this code runs in the gui thread.
* message-list.c (on_cursor_activated_idle): If nothing
selected/cursor not activated, then select no message.
* mail-folder-cache.c (update_1folder): Make the trash count
optional on EVOLUTION_COUNT_TRASH, becuase some lusers are just
too stupid to understand what its for.
* component-factory.c (storage_xfer_folder): Return slightly
better error codes for copying folders, since its not implemented
yet.
* mail-vfolder.c, mail-local.c, mail-folder-cache.c,
message-list.c component-factory.c, mail-ops.c,
subscribe-dialog.c, mail-session.c: d() out some debug printfs,
w() out some warnings.
* folder-browser-ui.c (folder_browser_ui_add_message): Fix typo,
Resent->Resend.
2001-10-29 Jeffrey Stedfast <fejj@ximian.com> 2001-10-29 Jeffrey Stedfast <fejj@ximian.com>
* mail-ops.c (transfer_messages_transfer): Don't warn the user if * mail-ops.c (transfer_messages_transfer): Don't warn the user if

View File

@ -55,6 +55,8 @@
#include "mail-vfolder.h" #include "mail-vfolder.h"
#include "mail-autofilter.h" #include "mail-autofilter.h"
#define d(x)
char *default_drafts_folder_uri; char *default_drafts_folder_uri;
CamelFolder *drafts_folder = NULL; CamelFolder *drafts_folder = NULL;
char *default_sent_folder_uri; char *default_sent_folder_uri;
@ -324,7 +326,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
GPtrArray *uids; GPtrArray *uids;
CamelURL *src, *dst; CamelURL *src, *dst;
printf("Renaming folder '%s' to dest '%s' type '%s'\n", source_physical_uri, destination_physical_uri, type); d(printf("Renaming folder '%s' to dest '%s' type '%s'\n", source_physical_uri, destination_physical_uri, type));
CORBA_exception_init (&ev); CORBA_exception_init (&ev);
@ -687,11 +689,11 @@ unref_standard_folders (void)
*standard_folders[i].folder = NULL; *standard_folders[i].folder = NULL;
if (CAMEL_OBJECT (folder)->ref_count == 1) if (CAMEL_OBJECT (folder)->ref_count == 1)
printf ("About to finalise folder %s\n", folder->full_name); d(printf ("About to finalise folder %s\n", folder->full_name));
else else
printf ("Folder %s still has %d extra ref%s on it\n", folder->full_name, d(printf ("Folder %s still has %d extra ref%s on it\n", folder->full_name,
CAMEL_OBJECT (folder)->ref_count - 1, CAMEL_OBJECT (folder)->ref_count - 1,
CAMEL_OBJECT (folder)->ref_count - 1 == 1 ? "" : "s"); CAMEL_OBJECT (folder)->ref_count - 1 == 1 ? "" : "s"));
camel_object_unref (CAMEL_OBJECT (folder)); camel_object_unref (CAMEL_OBJECT (folder));
} }
@ -1160,7 +1162,7 @@ storage_xfer_folder (EvolutionStorage *storage,
char *src, *dst; char *src, *dst;
char *p, c, sep; char *p, c, sep;
printf("Transfer folder on store source = '%s' dest = '%s'\n", source_path, destination_path); d(printf("Transfer folder on store source = '%s' dest = '%s'\n", source_path, destination_path));
/* Remap the 'path' to the camel friendly name based on the store dir separator */ /* Remap the 'path' to the camel friendly name based on the store dir separator */
sep = store->dir_sep; sep = store->dir_sep;
@ -1180,22 +1182,22 @@ storage_xfer_folder (EvolutionStorage *storage,
camel_exception_init (&ex); camel_exception_init (&ex);
if (remove_source) { if (remove_source) {
printf("trying to rename\n"); d(printf("trying to rename\n"));
camel_store_rename_folder(store, src, dst, &ex); camel_store_rename_folder(store, src, dst, &ex);
if (camel_exception_is_set(&ex))
notify_listener (listener, GNOME_Evolution_Storage_GENERIC_ERROR);
else
notify_listener (listener, GNOME_Evolution_Storage_OK);
} else { } else {
printf("No remove, can't rename\n"); d(printf("No remove, can't rename\n"));
camel_exception_setv(&ex, 1, "Can copy folders"); /* FIXME: Implement folder 'copy' for remote stores */
/* This exception never goes anywhere, so it doesn't need translating or using */
notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_OPERATION);
} }
g_free(src); g_free(src);
g_free(dst); g_free(dst);
if (camel_exception_is_set(&ex)) {
notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI);
} else {
notify_listener (listener, GNOME_Evolution_Storage_OK);
}
camel_exception_clear (&ex); camel_exception_clear (&ex);
} }

View File

@ -315,7 +315,7 @@ folder_browser_ui_add_message (FolderBrowser *fb)
/* Resend Message */ /* Resend Message */
if (fb->folder && !folder_browser_is_sent (fb)) if (fb->folder && !folder_browser_is_sent (fb))
fbui_sensitise_item(fb, "MessageResent", FALSE); fbui_sensitise_item(fb, "MessageResend", FALSE);
/* sensitivity of message-specific commands */ /* sensitivity of message-specific commands */
prev_state = fb->selection_state; prev_state = fb->selection_state;

View File

@ -47,6 +47,7 @@
#include "mail-vfolder.h" #include "mail-vfolder.h"
#include "mail-autofilter.h" #include "mail-autofilter.h"
#define w(x)
#define d(x) #define d(x)
/* note that many things are effectively serialised by having them run in /* note that many things are effectively serialised by having them run in
@ -113,6 +114,7 @@ static int update_id = -1;
/* hack for people who LIKE to have unsent count */ /* hack for people who LIKE to have unsent count */
static int count_sent = FALSE; static int count_sent = FALSE;
static int count_trash = FALSE;
static void static void
free_update(struct _folder_update *up) free_update(struct _folder_update *up)
@ -162,7 +164,7 @@ real_flush_updates(void *o, void *event_data, void *data)
/* Its really a rename, but we have no way of telling the shell that, so remove it */ /* Its really a rename, but we have no way of telling the shell that, so remove it */
if (up->oldpath) { if (up->oldpath) {
if (storage != NULL) { if (storage != NULL) {
printf("Removing old folder (rename?) '%s'\n", up->oldpath); d(printf("Removing old folder (rename?) '%s'\n", up->oldpath));
evolution_storage_removed_folder(storage, up->oldpath); evolution_storage_removed_folder(storage, up->oldpath);
} }
/* ELSE? Shell supposed to handle the local snot case */ /* ELSE? Shell supposed to handle the local snot case */
@ -170,7 +172,7 @@ real_flush_updates(void *o, void *event_data, void *data)
/* We can tell the vfolder code though */ /* We can tell the vfolder code though */
if (up->olduri && up->add) { if (up->olduri && up->add) {
printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri); d(printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri));
mail_vfolder_rename_uri(up->store, up->olduri, up->uri); mail_vfolder_rename_uri(up->store, up->olduri, up->uri);
mail_filter_rename_uri(up->store, up->olduri, up->uri); mail_filter_rename_uri(up->store, up->olduri, up->uri);
} }
@ -288,7 +290,9 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info)
folder = mfi->folder; folder = mfi->folder;
if (folder) { if (folder) {
if (CAMEL_IS_VTRASH_FOLDER (folder) || folder == outbox_folder || (count_sent && folder == sent_folder)) { if ((count_trash && CAMEL_IS_VTRASH_FOLDER (folder))
|| folder == outbox_folder
|| (count_sent && folder == sent_folder)) {
unread = camel_folder_get_message_count(folder); unread = camel_folder_get_message_count(folder);
} else { } else {
if (info) if (info)
@ -432,7 +436,7 @@ void mail_note_folder(CamelFolder *folder)
mfi = g_hash_table_lookup(si->folders, folder->full_name); mfi = g_hash_table_lookup(si->folders, folder->full_name);
if (mfi == NULL) { if (mfi == NULL) {
g_warning("Adding a folder `%s' that I dont know about yet?", folder->full_name); w(g_warning("Adding a folder `%s' that I dont know about yet?", folder->full_name));
UNLOCK(info_lock); UNLOCK(info_lock);
return; return;
} }
@ -674,7 +678,7 @@ mail_note_store_remove(CamelStore *store)
ud = (struct _update_data *)si->folderinfo_updates.head; ud = (struct _update_data *)si->folderinfo_updates.head;
while (ud->next) { while (ud->next) {
(printf("Cancelling outstanding folderinfo update %d\n", ud->id)); d(printf("Cancelling outstanding folderinfo update %d\n", ud->id));
mail_msg_cancel(ud->id); mail_msg_cancel(ud->id);
ud = ud->next; ud = ud->next;
} }
@ -735,6 +739,7 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St
if (stores == NULL) { if (stores == NULL) {
stores = g_hash_table_new(NULL, NULL); stores = g_hash_table_new(NULL, NULL);
count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL; count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL;
count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL;
} }
si = g_hash_table_lookup(stores, store); si = g_hash_table_lookup(stores, store);

View File

@ -490,7 +490,7 @@ mlf_set_folder(MailLocalFolder *mlf, guint32 flags, CamelException *ex)
/* mlf->real_folder = camel_store_get_folder(mlf->real_store, mlf->meta->name, flags, ex); */ /* mlf->real_folder = camel_store_get_folder(mlf->real_store, mlf->meta->name, flags, ex); */
mbox = g_strdup_printf("%s/%s", mlf->real_path, mlf->meta->name); mbox = g_strdup_printf("%s/%s", mlf->real_path, mlf->meta->name);
printf("Opening mbox on real path: %s\n", mbox); d(printf("Opening mbox on real path: %s\n", mbox));
mlf->real_folder = camel_store_get_folder(mlf->real_store, mbox, flags, ex); mlf->real_folder = camel_store_get_folder(mlf->real_store, mbox, flags, ex);
g_free(mbox); g_free(mbox);
if (mlf->real_folder == NULL) if (mlf->real_folder == NULL)
@ -984,7 +984,7 @@ static void mail_local_store_add_folder(MailLocalStore *mls, const char *uri, co
CamelFolderInfo *info = NULL; CamelFolderInfo *info = NULL;
CamelURL *url; CamelURL *url;
(printf("Shell adding folder: '%s' path = '%s'\n", uri, path)); d(printf("Shell adding folder: '%s' path = '%s'\n", uri, path));
url = camel_url_new(uri, NULL); url = camel_url_new(uri, NULL);
if (url == NULL) { if (url == NULL) {
@ -1041,7 +1041,7 @@ static void mail_local_store_remove_folder(MailLocalStore *mls, const char *path
{ {
struct _search_info data = { path, NULL }; struct _search_info data = { path, NULL };
printf("shell removing folder? '%s'\n", path); d(printf("shell removing folder? '%s'\n", path));
/* we're keyed on uri, not path, so have to search for it manually */ /* we're keyed on uri, not path, so have to search for it manually */

View File

@ -50,7 +50,8 @@
#include "mail-mt.h" #include "mail-mt.h"
#include "mail-folder-cache.h" #include "mail-folder-cache.h"
#define d(x) x #define w(x)
#define d(x)
/* used for both just filtering a folder + uid's, and for filtering a whole folder */ /* used for both just filtering a folder + uid's, and for filtering a whole folder */
/* used both for fetching mail, and for filtering mail */ /* used both for fetching mail, and for filtering mail */
@ -1106,8 +1107,8 @@ get_folderinfo_got (struct _mail_msg *mm)
char *url; char *url;
url = camel_service_get_url (CAMEL_SERVICE (m->store)); url = camel_service_get_url (CAMEL_SERVICE (m->store));
g_warning ("Error getting folder info from store at %s: %s", w(g_warning ("Error getting folder info from store at %s: %s",
url, camel_exception_get_description (&mm->ex)); url, camel_exception_get_description (&mm->ex)));
g_free (url); g_free (url);
} }

View File

@ -936,29 +936,29 @@ mail_session_enable_interaction (gboolean enable)
struct _pass_msg *pm; struct _pass_msg *pm;
struct _user_message_msg *um; struct _user_message_msg *um;
printf("Gone non-interactive, checking for outstanding interactive tasks\n"); d(printf("Gone non-interactive, checking for outstanding interactive tasks\n"));
/* clear out pending password requests */ /* clear out pending password requests */
while ((pm = (struct _pass_msg *)e_dlist_remhead(&password_list))) { while ((pm = (struct _pass_msg *)e_dlist_remhead(&password_list))) {
printf("Flushing password request : %s\n", pm->prompt); d(printf("Flushing password request : %s\n", pm->prompt));
e_msgport_reply((EMsg *)pm); e_msgport_reply((EMsg *)pm);
} }
/* destroy the current */ /* destroy the current */
if (password_dialogue) { if (password_dialogue) {
printf("Destroying password dialogue\n"); d(printf("Destroying password dialogue\n"));
gtk_object_destroy((GtkObject *)password_dialogue); gtk_object_destroy((GtkObject *)password_dialogue);
} }
/* same for pending user messages */ /* same for pending user messages */
while ((um = (struct _user_message_msg *)e_dlist_remhead(&message_list))) { while ((um = (struct _user_message_msg *)e_dlist_remhead(&message_list))) {
printf("Flusing message request: %s\n", um->prompt); d(printf("Flusing message request: %s\n", um->prompt));
e_msgport_reply((EMsg *)um); e_msgport_reply((EMsg *)um);
} }
/* and the current */ /* and the current */
if (message_dialogue) { if (message_dialogue) {
printf("Destroying message dialogue\n"); d(printf("Destroying message dialogue\n"));
gtk_object_destroy((GtkObject *)message_dialogue); gtk_object_destroy((GtkObject *)message_dialogue);
} }
} }

View File

@ -475,7 +475,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to)
if (changed) { if (changed) {
char *user; char *user;
printf("Vfolders updated from renamed folder\n"); d(printf("Vfolders updated from renamed folder\n"));
user = g_strdup_printf("%s/vfolders.xml", evolution_dir); user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
rule_context_save((RuleContext *)context, user); rule_context_save((RuleContext *)context, user);
g_free(user); g_free(user);
@ -550,7 +550,7 @@ rule_changed(FilterRule *rule, CamelFolder *folder)
else else
sources_uri = g_list_append(sources_uri, g_strdup(l->data)); sources_uri = g_list_append(sources_uri, g_strdup(l->data));
} else { } else {
printf(" -> No such folder?\n"); d(printf(" -> No such folder?\n"));
} }
l = l->next; l = l->next;
} }

View File

@ -1766,7 +1766,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes)
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
#endif #endif
printf("updating changes to display\n"); d(printf("updating changes to display\n"));
/* remove individual nodes? */ /* remove individual nodes? */
d(printf("Removing messages from view:\n")); d(printf("Removing messages from view:\n"));
@ -1977,9 +1977,12 @@ on_cursor_activated_idle (gpointer data)
gint selected = e_selection_model_selected_count (esm); gint selected = e_selection_model_selected_count (esm);
if (selected == 1 && message_list->cursor_uid) { if (selected == 1 && message_list->cursor_uid) {
printf ("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid); d(printf ("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid));
gtk_signal_emit (GTK_OBJECT (message_list), gtk_signal_emit (GTK_OBJECT (message_list),
message_list_signals[MESSAGE_SELECTED], message_list->cursor_uid); message_list_signals[MESSAGE_SELECTED], message_list->cursor_uid);
} else {
gtk_signal_emit (GTK_OBJECT (message_list),
message_list_signals[MESSAGE_SELECTED], NULL);
} }
message_list->idle_id = 0; message_list->idle_id = 0;

View File

@ -53,7 +53,7 @@
#include "art/empty.xpm" #include "art/empty.xpm"
#include "art/mark.xpm" #include "art/mark.xpm"
#define d(x) x #define d(x)
/* Things to test. /* Things to test.
* - Feature * - Feature
@ -829,7 +829,7 @@ fe_done_subscribing (const char *full_name, const char *name, gboolean subscribe
{ {
ftree_op_data *closure = (ftree_op_data *) user_data; ftree_op_data *closure = (ftree_op_data *) user_data;
if (success) { if (success && closure->handle != -1) {
char *path; char *path;
path = fe_node_to_shell_path (closure->data); path = fe_node_to_shell_path (closure->data);
@ -850,7 +850,9 @@ fe_done_subscribing (const char *full_name, const char *name, gboolean subscribe
e_tree_model_node_data_changed (E_TREE_MODEL (closure->ftree), closure->path); e_tree_model_node_data_changed (E_TREE_MODEL (closure->ftree), closure->path);
} }
g_hash_table_remove (closure->ftree->subscribe_ops, closure->path); if (closure->handle != -1)
g_hash_table_remove (closure->ftree->subscribe_ops, closure->path);
g_free (closure); g_free (closure);
} }
@ -864,10 +866,9 @@ fe_cancel_op_foreach (gpointer key, gpointer value, gpointer user_data)
if (closure->handle != -1) if (closure->handle != -1)
mail_msg_cancel (closure->handle); mail_msg_cancel (closure->handle);
else
printf ("aaagh, annoying race condition in fe_cancel_op_foreach.\n");
g_free (value); closure->handle = -1;
return TRUE; return TRUE;
} }
@ -1135,7 +1136,7 @@ static void
store_data_async_get_store (StoreData *sd, StoreDataStoreFunc func, gpointer user_data) store_data_async_get_store (StoreData *sd, StoreDataStoreFunc func, gpointer user_data)
{ {
if (sd->request_id) { if (sd->request_id) {
printf ("Already loading store, nooping\n"); d(printf ("Already loading store, nooping\n"));
return; return;
} }