Merge pull request #20148 from fnlctrl/icc-lazy-finalization-registry
Lazy initialize FinalizationRegistry used by IccColorSpace.#finalizer
This commit is contained in:
commit
d41f144716
@ -48,9 +48,7 @@ class IccColorSpace extends ColorSpace {
|
|||||||
|
|
||||||
static #wasmUrl = null;
|
static #wasmUrl = null;
|
||||||
|
|
||||||
static #finalizer = new FinalizationRegistry(transformer => {
|
static #finalizer = null;
|
||||||
qcms_drop_transformer(transformer);
|
|
||||||
});
|
|
||||||
|
|
||||||
constructor(iccProfile, name, numComps) {
|
constructor(iccProfile, name, numComps) {
|
||||||
if (!IccColorSpace.isUsable) {
|
if (!IccColorSpace.isUsable) {
|
||||||
@ -100,6 +98,9 @@ class IccColorSpace extends ColorSpace {
|
|||||||
if (!this.#transformer) {
|
if (!this.#transformer) {
|
||||||
throw new Error("Failed to create ICC color space");
|
throw new Error("Failed to create ICC color space");
|
||||||
}
|
}
|
||||||
|
IccColorSpace.#finalizer ||= new FinalizationRegistry(transformer => {
|
||||||
|
qcms_drop_transformer(transformer);
|
||||||
|
});
|
||||||
IccColorSpace.#finalizer.register(this, this.#transformer);
|
IccColorSpace.#finalizer.register(this, this.#transformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user