Skip to content

Commit

Permalink
Merge pull request #19059 from Snuffleupagus/DOMFilterFactory-rm-_hcm…
Browse files Browse the repository at this point in the history
…Cache

Improve clean-up of `#_hcmCache`-data in `DOMFilterFactory.prototype.destroy`
  • Loading branch information
timvandermeij authored Nov 17, 2024
2 parents bc91985 + 4c57ec4 commit fc04849
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/display/filter_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,17 +423,18 @@ class DOMFilterFactory extends BaseFilterFactory {
}

destroy(keepHCM = false) {
if (keepHCM && this.#hcmCache.size !== 0) {
if (keepHCM && this.#_hcmCache?.size) {
return;
}
if (this.#_defs) {
this.#_defs.parentNode.parentNode.remove();
this.#_defs = null;
}
if (this.#_cache) {
this.#_cache.clear();
this.#_cache = null;
}
this.#_defs?.parentNode.parentNode.remove();
this.#_defs = null;

this.#_cache?.clear();
this.#_cache = null;

this.#_hcmCache?.clear();
this.#_hcmCache = null;

this.#id = 0;
}

Expand Down

0 comments on commit fc04849

Please sign in to comment.