Skip to content

Commit 3d9374e

Browse files
committed
lazy initialize IccColorSpace.#finalizer
1 parent e9a4830 commit 3d9374e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/core/icc_colorspace.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class IccColorSpace extends ColorSpace {
4848

4949
static #wasmUrl = null;
5050

51-
static #finalizer = new FinalizationRegistry(transformer => {
52-
qcms_drop_transformer(transformer);
53-
});
51+
static #finalizer = null;
5452

5553
constructor(iccProfile, name, numComps) {
5654
if (!IccColorSpace.isUsable) {
@@ -100,6 +98,9 @@ class IccColorSpace extends ColorSpace {
10098
if (!this.#transformer) {
10199
throw new Error("Failed to create ICC color space");
102100
}
101+
IccColorSpace.#finalizer ||= new FinalizationRegistry(transformer => {
102+
qcms_drop_transformer(transformer);
103+
});
103104
IccColorSpace.#finalizer.register(this, this.#transformer);
104105
}
105106

0 commit comments

Comments
 (0)