Fix section hash

This commit is contained in:
jpirnay
2026-05-10 21:26:52 +02:00
parent ba30ed029f
commit f48636c2b9
+7 -4
View File
@@ -353,6 +353,9 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
return false;
}
// Evict old variants for this spine to keep cache size controlled BEFORE creating the new one
evictOldVariants();
if (!Storage.openFileForWrite("SCT", filePath, file)) {
return false;
}
@@ -365,9 +368,6 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
std::string contentBase = (lastSlash != std::string::npos) ? localPath.substr(0, lastSlash + 1) : "";
std::string imageBasePath = getImageBasePath(propertyHash);
// Evict old variants for this spine to keep cache size controlled
evictOldVariants();
CssParser* cssParser = nullptr;
if (embeddedStyle) {
cssParser = epub->getCssParser();
@@ -483,13 +483,16 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
serialization::writePod(file, lutOffset);
serialization::writePod(file, anchorMapOffset);
serialization::writePod(file, paragraphLutOffset);
file.close();
file.flush();
if (cssParser) {
cssParser->clear();
}
buildTocBoundaries(anchors);
file.close();
// Cache the LUT in memory and open the file for reading so that
// subsequent loadPageFromSectionFile() calls can seek directly without re-opening.
if (!Storage.openFileForRead("SCT", filePath, file)) {