I have a cross-folder saved search of unread messages in my incoming folders that occasionally gets its total and unread counts off by 1 or 2 (too high) and that persists when you click out of the folder, until you return to the saved search. It turns out this happens if I read/delete messages that are put in the view from the cached headers, before the search completes. We were counting the total and unread counts from the search hits as they came in, but not adjusting those counts based on changes happening during the search. I could try to adjust the counts as messages are read/deleted while the search is going on, but I think the easiest thing is to just set the totals based on the messages in the view, when the search is done.
Created attachment 242218 [details] [diff] [review] proposed fix
fixed on trunk and branch