Skip to content

Commit

Permalink
lib-storage: Update mailbox.recent_flags_count correctly.
Browse files Browse the repository at this point in the history
The counter was increased even if the UID was already in recent_flags.
This is the only place where I found that recent_flags and
recent_flags_count could become desynced (which they definitely were in
a core dump), so hopefully this fixes assert-crashes like:

Panic: file index-status.c: line 130 (index_storage_get_open_status): assertion failed: (status_r->recent <= status_r->messages)
  • Loading branch information
sirainen committed Sep 27, 2016
1 parent 6d8be32 commit 8428e40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib-storage/mailbox-recent-flags.c
Expand Up @@ -23,8 +23,10 @@ void mailbox_recent_flags_set_uid_forced(struct mailbox *box, uint32_t uid)
{
box->recent_flags_prev_uid = uid;

seq_range_array_add_with_init(&box->recent_flags, 64, uid);
box->recent_flags_count++;
if (!mailbox_recent_flags_have_uid(box, uid)) {
seq_range_array_add_with_init(&box->recent_flags, 64, uid);
box->recent_flags_count++;
}
}

void mailbox_recent_flags_set_seqs(struct mailbox *box,
Expand Down

0 comments on commit 8428e40

Please sign in to comment.