mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-12 08:52:40 +00:00
* fix(cos): a clone that edits an object stream or a /Length stops reading what other clones cached Clones share the object cache and the parsed object streams. #5802 keeps results that read a clone's edits out of those shared maps, but a clone could still read entries cached before its edit, by another clone or by itself: after replacing object stream 4, a member of it still read as the file's copy, and a stream or object stream framed by an indirect /Length kept the file's framing after the length was edited. Each cached load now records the other objects it read (a member's object stream, an indirect /Length, and what those read in turn), and a document whose edits include one of them reads the object again. Documents with no edits read the shared entries as before. This also replaces forgetting a stream's cached member failures on every edit, which the same check covers for the editing document without costing other clones their entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cos): count a reference read as null in what a load read A reference whose generation doesn't match the file reads as null, but an edit that sets that generation makes it match. A load that read null there (an object stream's /DecodeParms by reference, say) now counts the object as read, so a clone that sets it decodes the stream again instead of taking the one another clone cached. Reads keep a shared slice, and the read bound has its own test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(optimize): edit the object stream without breaking it space_audit_shares_an_object_stream_..._edited_members set the stream's /First to 999999 and still expected its members to read, which only held while a stale shared-cache entry answered for them. Mark the stream with an unrelated key instead: it is still edited, so its members are sized on their own, and they stay readable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cos): keep an object stream decoded by edited parameters out of the shared cache Whether an object stream is the loading document's own was settled before its indirect /DecodeParms were read. A clone that edited them decoded the stream by its edit and put the result in the cache its clones share, so the document it came from read the clone's data. The check now runs after decoding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: KenM76 <KenM76> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>