[balsa] Various: Do not crash when selecting Apply



commit 0c31c27d96d6f330cc54d13d2bf7eabbcce1a618
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Jun 8 19:57:32 2020 -0400

    Various: Do not crash when selecting Apply
    
    Do not crash when selecting "Apply selected" when the mailbox is not
    being viewed in the main window.
    
    * libbalsa/mailbox_local.c (message_match_real): check for NULL values;
    * src/filter-run-dialog.c (balsa_filter_run_dialog_new):
        call prepare-threading to get ready for filtering.

 ChangeLog                | 10 ++++++++++
 libbalsa/mailbox_local.c |  2 ++
 src/filter-run-dialog.c  |  1 +
 3 files changed, 13 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index 4100126c7..9aa15ead1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-06-08  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Do not crash when selecting "Apply selected" when the mailbox is
+       not being viewed in the main window.
+
+       * libbalsa/mailbox_local.c (message_match_real): check for NULL
+       values;
+       * src/filter-run-dialog.c (balsa_filter_run_dialog_new): call
+       prepare-threading to get ready for filtering.
+
 2020-06-06  Peter Bloomfield  <pbloomfield bellsouth net>
 
        balsa-message: Do not crash
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 34f342a0e..22b0f41bc 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -846,6 +846,8 @@ message_match_real(LibBalsaMailbox *mailbox, guint msgno,
         lbm_local_cache_message(local, msgno, message);
         entry = libbalsa_mailbox_get_index_entry(mailbox, msgno);
         info  = g_ptr_array_index(priv->threading_info, msgno - 1);
+        if (entry == NULL || info == NULL)
+            return FALSE;
     }
 
     if (entry->idle_pending)
diff --git a/src/filter-run-dialog.c b/src/filter-run-dialog.c
index e13a4d298..337f47d7a 100644
--- a/src/filter-run-dialog.c
+++ b/src/filter-run-dialog.c
@@ -171,6 +171,7 @@ balsa_filter_run_dialog_new(LibBalsaMailbox *mbox,
     /* We set the dialog title */
     p->mbox = mbox;
     libbalsa_mailbox_open(p->mbox, NULL);
+    libbalsa_mailbox_prepare_threading(p->mbox, 0);
     dialog_title = g_strconcat(_("Filters of Mailbox: "),
                                libbalsa_mailbox_get_name(p->mbox), NULL);
     gtk_window_set_title(GTK_WINDOW(p), dialog_title);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]