From 88524bf9aee39b18801f7ce4bc73ee9f74790517 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 20 Jul 2023 15:36:08 +0200 Subject: [PATCH] Don't reset temporary XRef-entries during saving (PR 16392 follow-up) *Please note:* I'm not aware of any bugs caused by this, however that might be more luck than anything else. In PR 16392 the `incrementalUpdate` function, and all of its various helpers, were made asynchronous. However the call-site in `src/core/worker.js` wasn't updated, which means that we currently reset temporary XRef-entries while saving is ongoing. --- src/core/worker.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/core/worker.js b/src/core/worker.js index 7b04b8226..a606c74f3 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -661,23 +661,21 @@ class WorkerMessageHandler { }; } - try { - return incrementalUpdate({ - originalData: stream.bytes, - xrefInfo: newXrefInfo, - newRefs, - xref, - hasXfa: !!xfa, - xfaDatasetsRef, - hasXfaDatasetsEntry, - needAppearances, - acroFormRef, - acroForm, - xfaData, - }); - } finally { + return incrementalUpdate({ + originalData: stream.bytes, + xrefInfo: newXrefInfo, + newRefs, + xref, + hasXfa: !!xfa, + xfaDatasetsRef, + hasXfaDatasetsEntry, + needAppearances, + acroFormRef, + acroForm, + xfaData, + }).finally(() => { xref.resetNewTemporaryRef(); - } + }); }); } );