Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
fix: memory leak with pdf worker
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Jul 14, 2022
1 parent 2fb6b5f commit ec07cdb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addon/chrome/content/previewPDF.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
console.log(e);
if (e.data.type === "renderPreview") {
if (itemID !== e.data.itemID) {
// Destroy worker to avoid memory leak
pdf && pdf.destroy();
pdf = await pdfjsLib.getDocument(e.data.buffer).promise;
delete e.data.buffer;
itemID = e.data.itemID;
}
renderPreview(e.data.itemID, e.data.width);
Expand Down

0 comments on commit ec07cdb

Please sign in to comment.