Skip to content

Commit

Permalink
Add missing startWorkerTask calls in the "SaveDocument" handler
Browse files Browse the repository at this point in the history
Without these calls we'll not actually wait for saving to complete when document destruction runs; compare with other `WorkerTask`-usage in this file.
While I cannot imagine that this has caused any problems for library users, the code is however not technically correct as-is.
  • Loading branch information
Snuffleupagus committed Dec 21, 2024
1 parent dd5618e commit ec1a05c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class WorkerMessageHandler {
if (isPureXfa) {
const task = new WorkerTask("loadXfaFonts");
startWorkerTask(task);

await Promise.all([
pdfManager
.loadXfaFonts(handler, task)
Expand Down Expand Up @@ -590,6 +591,8 @@ class WorkerMessageHandler {
newAnnotationPromises.push(
pdfManager.getPage(pageIndex).then(page => {
const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
startWorkerTask(task);

return page
.saveNewAnnotations(
handler,
Expand Down Expand Up @@ -637,6 +640,8 @@ class WorkerMessageHandler {
promises.push(
pdfManager.getPage(pageIndex).then(function (page) {
const task = new WorkerTask(`Save: page ${pageIndex}`);
startWorkerTask(task);

return page
.save(handler, task, annotationStorage, changes)
.finally(function () {
Expand Down

0 comments on commit ec1a05c

Please sign in to comment.