Skip to content
Snippets Groups Projects
Commit 932c0045 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

fabricjs: remove all event listeners at the end to avoid a leak

It registers an event listener on the window object which keeps a reference
on the canvas object.
parent 620d2a55
Branches
No related tags found
No related merge requests found
Pipeline #18259 passed with warnings
...@@ -85,6 +85,10 @@ export class PdfPreview extends ScopedElementsMixin(DBPLitElement) { ...@@ -85,6 +85,10 @@ export class PdfPreview extends ScopedElementsMixin(DBPLitElement) {
} }
disconnectedCallback() { disconnectedCallback() {
if (this.fabricCanvas !== null) {
this.fabricCanvas.removeListeners();
this.fabricCanvas = null;
}
window.removeEventListener('resize', this._onWindowResize); window.removeEventListener('resize', this._onWindowResize);
super.disconnectedCallback(); super.disconnectedCallback();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment