[evolution-data-server/gnome-3-36] evo-I#982 - 'Message contains'-search broken in 3.36.3 ][
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-36] evo-I#982 - 'Message contains'-search broken in 3.36.3 ][
- Date: Mon, 15 Jun 2020 13:18:52 +0000 (UTC)
commit c05b38e18f74ecf733687151029c8024c4f73151
Author: Milan Crha <mcrha redhat com>
Date: Mon Jun 15 15:15:58 2020 +0200
evo-I#982 - 'Message contains'-search broken in 3.36.3 ][
Fix incorrect result, where the first call, which did the server-side
call, could return currently processed message as matching, even when
it did not match the search criteria.
Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/982
src/camel/providers/imapx/camel-imapx-search.c | 38 ++++++++++++--------------
1 file changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-search.c b/src/camel/providers/imapx/camel-imapx-search.c
index 7c62443b8..2a34b389c 100644
--- a/src/camel/providers/imapx/camel-imapx-search.c
+++ b/src/camel/providers/imapx/camel-imapx-search.c
@@ -244,18 +244,32 @@ imapx_search_process_criteria (CamelSExp *sexp,
}
}
+ if (!cached_results) {
+ cached_results = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)
camel_pstring_free, NULL);
+
+ if (uids) {
+ guint ii;
+
+ for (ii = 0; ii < uids->len; ii++) {
+ g_hash_table_insert (cached_results, (gpointer) camel_pstring_strdup
(uids->pdata[ii]), NULL);
+ }
+ }
+
+ g_hash_table_insert (imapx_search->priv->cached_results, criteria_desc, cached_results);
+ } else {
+ g_free (criteria_desc);
+ }
+
info = camel_folder_search_get_current_message_info (search);
if (info) {
result = camel_sexp_result_new (sexp, CAMEL_SEXP_RES_BOOL);
- result->value.boolean = cached_results ? g_hash_table_contains (cached_results,
camel_message_info_get_uid (info)) : (uids && uids->len > 0);
+ result->value.boolean = g_hash_table_contains (cached_results, camel_message_info_get_uid
(info));
} else {
- if (cached_results) {
+ if (!uids) {
GHashTableIter iter;
gpointer key;
- g_warn_if_fail (uids == NULL);
-
uids = g_ptr_array_sized_new (g_hash_table_size (cached_results));
g_hash_table_iter_init (&iter, cached_results);
@@ -269,22 +283,6 @@ imapx_search_process_criteria (CamelSExp *sexp,
result->value.ptrarray = g_ptr_array_ref (uids);
}
- if (!cached_results) {
- cached_results = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)
camel_pstring_free, NULL);
-
- if (uids) {
- guint ii;
-
- for (ii = 0; ii < uids->len; ii++) {
- g_hash_table_insert (cached_results, (gpointer) camel_pstring_strdup
(uids->pdata[ii]), NULL);
- }
- }
-
- g_hash_table_insert (imapx_search->priv->cached_results, criteria_desc, cached_results);
- } else {
- g_free (criteria_desc);
- }
-
if (uids)
g_ptr_array_unref (uids);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]