1481: fix bug in index deletion r=Kerollmops a=MarinPostma

this bug was caused by a heed iterator entry being deleted while still holding a reference to it.


close #1333


Co-authored-by: mpostma <postma.marin@protonmail.com>
This commit is contained in:
bors[bot] 2021-07-06 08:07:30 +00:00 committed by GitHub
commit 487d82773a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -442,13 +442,16 @@ impl UpdateStore {
while let Some(Ok(((_, uuid, _), pending))) = pendings.next() { while let Some(Ok(((_, uuid, _), pending))) = pendings.next() {
if uuid == index_uuid { if uuid == index_uuid {
unsafe {
pendings.del_current()?;
}
let mut pending = pending.decode()?; let mut pending = pending.decode()?;
if let Some(update_uuid) = pending.content.take() { if let Some(update_uuid) = pending.content.take() {
uuids_to_remove.push(update_uuid); uuids_to_remove.push(update_uuid);
} }
// Invariant check: we can only delete the current entry when we don't hold
// references to it anymore. This must be done after we have retrieved its content.
unsafe {
pendings.del_current()?;
}
} }
} }