Fixes crash when removing unfulfilled during writebehind operation
Encountered this morning -- list operation had unfulfilled emails waiting for network operations but folder normalization determined they were missing and used a writebehind to remove them from the operation, but the loop to remove them explodes (can't do a remove within a foreach). This loop solves that problem.
This commit is contained in:
parent
2aa63900b4
commit
0df2c1fa7c
1 changed files with 12 additions and 2 deletions
|
|
@ -95,8 +95,18 @@ private abstract class Geary.ImapEngine.AbstractListEmail : Geary.ImapEngine.Sen
|
|||
}
|
||||
|
||||
// remove from unfulfilled list, as there's nothing to fetch from the server
|
||||
foreach (Geary.Email.Field field in unfulfilled.get_keys())
|
||||
unfulfilled.remove(field, id);
|
||||
// this funky little loop ensures that all mentions of the EmailIdentifier in
|
||||
// the unfulfilled MultiMap are removed, but must restart loop because removing
|
||||
// within a foreach invalidates the Iterator
|
||||
bool removed = false;
|
||||
do {
|
||||
removed = false;
|
||||
foreach (Geary.Email.Field field in unfulfilled.get_keys()) {
|
||||
removed = unfulfilled.remove(field, id);
|
||||
if (removed)
|
||||
break;
|
||||
}
|
||||
} while (removed);
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue