Primarily this fixes the crash:
index-search-result.c: line 132 (index_search_result_update_flags):
assertion failed: (result->search_args->args == &search_arg)
It could be triggered by:
a search return (update) body body seen
b store 1 +flags \seen
c store 1 -flags \seen
/* Stop mail_search_next() when finding a non-matching mail.
(Could be useful when wanting to find only the oldest mails.) */
unsigned int stop_on_nonmatch:1;
+ /* fts plugin has already expanded the search args - no need to do
+ it again. */
+ unsigned int fts_expanded:1;
};
#define ARG_SET_RESULT(arg, res) \
{
struct mail_search_arg *args_dup, *orig_args = args->args;
+ /* don't keep re-expanding every time the search args are used.
+ this is especially important to avoid an assert-crash in
+ index_search_result_update_flags(). */
+ if (args->fts_expanded)
+ return 0;
+ args->fts_expanded = TRUE;
+
/* duplicate the args, so if expansion fails we haven't changed
anything */
args_dup = mail_search_arg_dup(args->pool, args->args);