** See bug #63521.
authorNot Zed <NotZed@Ximian.com>
Mon, 27 Sep 2004 05:30:11 +0000 (05:30 +0000)
committerMichael Zucci <zucchi@src.gnome.org>
Mon, 27 Sep 2004 05:30:11 +0000 (05:30 +0000)
2004-09-21  Not Zed  <NotZed@Ximian.com>

        ** See bug #63521.

        * camel-movemail.c (camel_movemail): don't clear exception on entry.

        * camel-folder-search.c (match_words_message): use local exception.

        * camel-operation.c (camel_operation_cancel_check): soak up all
        cancellation requests as soon as we get one.
        (camel_operation_uncancel): soak up all cancellation reqeusts when
        we uncancel.

        * camel-uid-cache.c (camel_uid_cache_save): open the file O_TRUNC
        rather than O_EXCL, otherwise a crash would mean this file never
        gets updated.
        (camel_uid_cache_save): block cancellation around writes otherwise
        we could be interupted from old cancellation.

        * providers/local/camel-local-folder.c
        (camel_local_folder_construct): don't clear exception here, just
        don't pass it to summary load.

        * providers/pop3/camel-pop3-store.c (pop3_connect): only clear the
        exception when we received one we handled.

        * camel-filter-driver.c (close_folder): if exception is already
        set, don't pass it to folder.sync().

        * camel-lock.c (camel_lock_folder): don't clear the exception
        here, if it came in set its a programming error.

        * camel-filter-driver.c (camel_filter_driver_filter_message): if
        the exception is set after evaluating the expression, stop
        immediately.

camel/ChangeLog
camel/camel-filter-driver.c
camel/camel-folder-search.c
camel/camel-lock.c
camel/camel-movemail.c
camel/camel-operation.c
camel/camel-uid-cache.c
camel/providers/local/camel-local-folder.c
camel/providers/pop3/camel-pop3-store.c

index f68d97d..8a690a8 100644 (file)
@@ -1,3 +1,39 @@
+2004-09-21  Not Zed  <NotZed@Ximian.com>
+
+       ** See bug #63521.
+
+       * camel-movemail.c (camel_movemail): don't clear exception on entry.
+
+       * camel-folder-search.c (match_words_message): use local exception.
+
+       * camel-operation.c (camel_operation_cancel_check): soak up all
+       cancellation requests as soon as we get one.
+       (camel_operation_uncancel): soak up all cancellation reqeusts when
+       we uncancel.
+
+       * camel-uid-cache.c (camel_uid_cache_save): open the file O_TRUNC
+       rather than O_EXCL, otherwise a crash would mean this file never
+       gets updated.
+       (camel_uid_cache_save): block cancellation around writes otherwise
+       we could be interupted from old cancellation.
+
+       * providers/local/camel-local-folder.c
+       (camel_local_folder_construct): don't clear exception here, just
+       don't pass it to summary load.
+
+       * providers/pop3/camel-pop3-store.c (pop3_connect): only clear the
+       exception when we received one we handled.
+
+       * camel-filter-driver.c (close_folder): if exception is already
+       set, don't pass it to folder.sync().
+
+       * camel-lock.c (camel_lock_folder): don't clear the exception
+       here, if it came in set its a programming error.
+
+       * camel-filter-driver.c (camel_filter_driver_filter_message): if
+       the exception is set after evaluating the expression, stop
+       immediately.
+
 2004-09-13  Not Zed  <NotZed@Ximian.com>
 
        ** See bug #47821.
index cf98894..dfb88b8 100644 (file)
@@ -937,7 +937,7 @@ close_folder (void *key, void *value, void *data)
        g_free (key);
 
        if (folder != FOLDER_INVALID) {
-               camel_folder_sync (folder, FALSE, p->ex);
+               camel_folder_sync (folder, FALSE, camel_exception_is_set(p->ex)?NULL : p->ex);
                camel_folder_thaw (folder);
                camel_object_unref (folder);
        }
@@ -1422,6 +1422,9 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
                                goto error;
                        }
                        r = e_sexp_eval (p->eval);
+                       if (camel_exception_is_set(p->ex))
+                               goto error;
+
                        if (r == NULL) {
                                camel_exception_setv (ex, 1, _("Error executing filter: %s: %s"),
                                                      e_sexp_error (p->eval), node->action);
index bb570b8..b7578ba 100644 (file)
@@ -1109,15 +1109,16 @@ match_words_message(CamelFolder *folder, const char *uid, struct _camel_search_w
 {
        guint32 mask;
        CamelMimeMessage *msg;
+       CamelException x = CAMEL_EXCEPTION_INITIALISER;
        int truth;
 
-       msg = camel_folder_get_message(folder, uid, ex);
+       msg = camel_folder_get_message(folder, uid, &x);
        if (msg) {
                mask = 0;
                truth = match_words_1message((CamelDataWrapper *)msg, words, &mask);
                camel_object_unref((CamelObject *)msg);
        } else {
-               camel_exception_clear(ex);
+               camel_exception_clear(&x);
                truth = FALSE;
        }
 
index dd52daa..eeae181 100644 (file)
@@ -314,8 +314,6 @@ camel_lock_folder(const char *path, int fd, CamelLockType type, CamelException *
                if (retry > 0)
                        sleep(CAMEL_LOCK_DELAY);
 
-               camel_exception_clear(ex);
-
                if (camel_lock_fcntl(fd, type, ex) == 0) {
                        if (camel_lock_flock(fd, type, ex) == 0) {
                                if (camel_lock_dot(path, ex) == 0)
index 521d21d..619d3dc 100644 (file)
@@ -91,8 +91,6 @@ camel_movemail(const char *source, const char *dest, CamelException *ex)
        int sfd, dfd;
        struct stat st;
 
-       camel_exception_clear(ex);
-
        /* Stat and then open the spool file. If it doesn't exist or
         * is empty, the user has no mail. (There's technically a race
         * condition here in that an MDA might have just now locked it
index 7c64125..adf4c98 100644 (file)
@@ -334,7 +334,12 @@ camel_operation_uncancel(CamelOperation *cc)
                cc = (CamelOperation *)pthread_getspecific(operation_key);
 
        if (cc) {
+               CamelOperationMsg *msg;
+
                LOCK();
+               while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)))
+                       g_free(msg);
+
                cc->flags &= ~CAMEL_OPERATION_CANCELLED;
                UNLOCK();
        }
@@ -406,7 +411,9 @@ camel_operation_cancel_check (CamelOperation *cc)
                cancelled = TRUE;
        } else if ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port))) {
                d(printf("Got cancellation message\n"));
-               g_free(msg);
+               do {
+                       g_free(msg);
+               } while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)));
                cc->flags |= CAMEL_OPERATION_CANCELLED;
                cancelled = TRUE;
        } else
index 2a2a52d..f884c11 100644 (file)
@@ -153,7 +153,7 @@ camel_uid_cache_save (CamelUIDCache *cache)
        int fd;
        
        filename = g_strdup_printf ("%s~", cache->filename);
-       if ((fd = open (filename, O_WRONLY | O_CREAT | O_EXCL, 0666)) == -1) {
+       if ((fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) {
                g_free (filename);
                return FALSE;
        }
@@ -267,7 +267,7 @@ camel_uid_cache_get_new_uids (CamelUIDCache *cache, GPtrArray *uids)
        
        new_uids = g_ptr_array_new ();
        cache->level++;
-       
+
        for (i = 0; i < uids->len; i++) {
                struct _uid_state *state;
                
@@ -303,7 +303,7 @@ camel_uid_cache_save_uid (CamelUIDCache *cache, const char *uid)
        gpointer old_uid;
        
        g_return_if_fail (uid != NULL);
-       
+
        if (g_hash_table_lookup_extended (cache->uids, uid, (void **)&old_uid, (void **)&state)) {
                state->save = TRUE;
                state->level = cache->level;
@@ -311,7 +311,7 @@ camel_uid_cache_save_uid (CamelUIDCache *cache, const char *uid)
                state = g_new (struct _uid_state, 1);
                state->save = TRUE;
                state->level = cache->level;
-               
+
                g_hash_table_insert (cache->uids, g_strdup (uid), state);
        }
 }
index 4f15336..5900d48 100644 (file)
@@ -301,8 +301,8 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
        }
 
        folder->summary = (CamelFolderSummary *)CLOCALF_CLASS(lf)->create_summary(lf->summary_path, lf->folder_path, lf->index);
-       if (camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, ex) == -1) {
-               camel_exception_clear(ex);
+       if (camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, NULL) == -1) {
+               /* ? */
        }
        
        /*if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {*/
index 4e5c2ba..6870aa1 100644 (file)
@@ -601,7 +601,6 @@ pop3_connect (CamelService *service, CamelException *ex)
                return FALSE;
        
        do {
-               camel_exception_clear (ex);
                status = pop3_try_authenticate (service, reprompt, errbuf, ex);
                g_free (errbuf);
                errbuf = NULL;
@@ -612,6 +611,7 @@ pop3_connect (CamelService *service, CamelException *ex)
                        g_free (service->url->passwd);
                        service->url->passwd = NULL;
                        reprompt = TRUE;
+                       camel_exception_clear (ex);
                }
        } while (status != -1 && ex->id == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE);