Fix race condition in generating next/previous page references when using transparent mode. (#1456)

This commit is contained in:
Eric Scouten 2021-05-17 13:05:22 -07:00 committed by GitHub
parent f8c6ea2b00
commit 22c29fe936
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -313,6 +313,13 @@ impl Library {
}
for (key, (sorted, cannot_be_sorted, sort_by)) in updates {
let section_is_transparent = if let Some(section) = self.sections.get(key) {
section.meta.transparent
} else {
false
};
if !section_is_transparent {
// Find sibling between sorted pages first
let with_siblings = find_siblings(&sorted);
@ -335,12 +342,15 @@ impl Library {
page.lighter = val1;
page.heavier = val2;
}
SortBy::None => unreachable!("Impossible to find siblings in SortBy::None"),
SortBy::None => {
unreachable!("Impossible to find siblings in SortBy::None")
}
}
} else {
unreachable!("Sorting got an unknown page")
}
}
}
if let Some(s) = self.sections.get_mut(key) {
s.pages = sorted;