mail/listing.rs: fix RowsState::rename_env stale data

RowsState::rename_env was not updating all EnvelopeHash related fields
when a receiving an EnvelopeRename event, which can cause panics if the
listing tries to index it.

Concerns #426

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/428/head
Manos Pitsidianakis 4 months ago
parent dfc2bb4311
commit a82d1e1ebe
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -204,6 +204,7 @@ impl<T> RowsState<T> {
self.env_order.insert(new_hash, row); self.env_order.insert(new_hash, row);
} }
if let Some(thread) = self.env_to_thread.remove(&old_hash) { if let Some(thread) = self.env_to_thread.remove(&old_hash) {
self.env_to_thread.insert(new_hash, thread);
self.thread_to_env self.thread_to_env
.entry(thread) .entry(thread)
.or_default() .or_default()
@ -213,7 +214,7 @@ impl<T> RowsState<T> {
let selection_status = self.selection.remove(&old_hash).unwrap_or(false); let selection_status = self.selection.remove(&old_hash).unwrap_or(false);
self.selection.insert(new_hash, selection_status); self.selection.insert(new_hash, selection_status);
self.all_envelopes.remove(&old_hash); self.all_envelopes.remove(&old_hash);
self.all_envelopes.insert(old_hash); self.all_envelopes.insert(new_hash);
} }
} }

Loading…
Cancel
Save