lazy initialize IccColorSpace.#finalizer
This commit is contained in:
parent
e9a483014d
commit
3d9374e02e
@ -48,9 +48,7 @@ class IccColorSpace extends ColorSpace {
|
||||
|
||||
static #wasmUrl = null;
|
||||
|
||||
static #finalizer = new FinalizationRegistry(transformer => {
|
||||
qcms_drop_transformer(transformer);
|
||||
});
|
||||
static #finalizer = null;
|
||||
|
||||
constructor(iccProfile, name, numComps) {
|
||||
if (!IccColorSpace.isUsable) {
|
||||
@ -100,6 +98,9 @@ class IccColorSpace extends ColorSpace {
|
||||
if (!this.#transformer) {
|
||||
throw new Error("Failed to create ICC color space");
|
||||
}
|
||||
IccColorSpace.#finalizer ||= new FinalizationRegistry(transformer => {
|
||||
qcms_drop_transformer(transformer);
|
||||
});
|
||||
IccColorSpace.#finalizer.register(this, this.#transformer);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user