* in some cases, cancel_all would core, apparently because cur->data was invalid.
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 11 Jun 2007 16:25:03 +0000 (16:25 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 11 Jun 2007 16:25:03 +0000 (16:25 +0000)
  now, we don't crash, but give an error on stderr instead

pmo-trunk-r2160

src/modest-mail-operation-queue.c

index 600438b..faab5c5 100644 (file)
@@ -344,7 +344,10 @@ modest_mail_operation_queue_cancel_all (ModestMailOperationQueue *self)
        for(cur = operations_to_cancel; cur != NULL; cur = cur->next) {
                /* This triggers a progress_changed signal in which we remove
                 * the operation from the queue. */
-               modest_mail_operation_cancel (MODEST_MAIL_OPERATION (cur->data));
+               if (!MODEST_IS_MAIL_OPERATION(cur->data))
+                       g_printerr ("modest: cur->data is not a valid mail operation\n");
+               else
+                       modest_mail_operation_cancel (MODEST_MAIL_OPERATION (cur->data));
        }
 
        g_slist_free(operations_to_cancel);