fix bug #2909, 'Changing folder quickly can cause wrong email to be deleted'
authorPaul <paul@claws-mail.org>
Tue, 16 Apr 2013 08:50:48 +0000 (09:50 +0100)
committerPaul <paul@claws-mail.org>
Tue, 16 Apr 2013 08:50:48 +0000 (09:50 +0100)
src/summaryview.c

index c695538af96dce5b35829ad468ec2de1e3fd0edc..b0f62c16afd91d591f2d24585deace4eb656353c 100644 (file)
@@ -4372,6 +4372,8 @@ void summary_delete(SummaryView *summaryview)
        if (summary_is_locked(summaryview)) return;
 
        if (!summaryview->folder_item) return;
+       
+       START_LONG_OPERATION(summaryview, FALSE);
 
        if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
                if (!prefs_common.live_dangerously) {
@@ -4385,7 +4387,10 @@ void summary_delete(SummaryView *summaryview)
                                          buf,
                                          GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL);
                        g_free(buf);
-                       if (aval != G_ALERTALTERNATE) return;
+                       if (aval != G_ALERTALTERNATE) {
+                               END_LONG_OPERATION(summaryview);
+                               return;
+                       }
                }
        }
 
@@ -4402,7 +4407,6 @@ void summary_delete(SummaryView *summaryview)
 
        /* next code sets current row focus right. We need to find a row
         * that is not deleted. */
-       START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
        for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
                sel_last = GTK_CMCTREE_NODE(cur->data);