[balsa] mailbox-local: Check for error return value
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] mailbox-local: Check for error return value
- Date: Fri, 10 Jan 2020 23:10:27 +0000 (UTC)
commit 179dbfeab6ddb99676a06fd63ad273532ae5ec2f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri Jan 10 17:46:12 2020 -0500
mailbox-local: Check for error return value
* libbalsa/mailbox_local.c (libbalsa_mailbox_local_set_threading):
check the value returned by libbalsa_mailbox_prepare_threading();
if it is FALSE, the operation failed, perhaps because the mailbox was
closed or finalized, so just quit.
ChangeLog | 10 ++++++++++
libbalsa/mailbox_local.c | 14 ++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ff69f0ae2..43b77b77a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-10 Peter Bloomfield <pbloomfield bellsouth net>
+
+ mailbox-local: Check for error return value
+
+ * libbalsa/mailbox_local.c
+ (libbalsa_mailbox_local_set_threading): check the value returned
+ by libbalsa_mailbox_prepare_threading(); if it is FALSE, the
+ operation failed, perhaps because the mailbox was closed or
+ finalized, so just quit.
+
2020-01-10 Peter Bloomfield <pbloomfield bellsouth net>
Guard against mailbox being closed or finalized during a call to
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 8ef0e5e88..151691fe1 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -1183,6 +1183,7 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
gboolean natural = (thread_type == LB_MAILBOX_THREADING_FLAT
&& libbalsa_mailbox_get_sort_field(mailbox) ==
LB_MAILBOX_SORT_NO);
+ gboolean ok = TRUE;
libbalsa_mailbox_set_msg_tree(mailbox, g_node_new(NULL));
if (!lbm_local_restore_tree(local, &total)) {
@@ -1193,20 +1194,25 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
libbalsa_mailbox_set_msg_tree_changed(mailbox, FALSE);
if (total < libbalsa_mailbox_total_messages(mailbox)) {
- if (!natural)
+ if (!natural) {
/* Get message info for all messages that weren't restored,
* so we can thread and sort them correctly before the
* mailbox is displayed. */
- libbalsa_mailbox_prepare_threading(mailbox, total);
- libbalsa_mailbox_local_load_messages(mailbox, total);
+ ok = libbalsa_mailbox_prepare_threading(mailbox, total);
+ }
+ if (ok)
+ libbalsa_mailbox_local_load_messages(mailbox, total);
+ else
+ return; /* Something bad happened */
}
#if defined(DEBUG_LOADING_AND_THREADING)
printf("after load messages: time=%lu\n", (unsigned long) time(NULL));
#endif
- if (natural)
+ if (natural) {
/* No need to thread. */
return;
+ }
}
if (libbalsa_am_i_subthread()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]