Skip to content

Commit

Permalink
Merge pull request #18171 from Snuffleupagus/move-pendingTextLayers
Browse files Browse the repository at this point in the history
Don't register a pending `TextLayer` until `render` is invoked (PR 18104 follow-up)
  • Loading branch information
timvandermeij authored May 28, 2024
2 parents aac738c + f2e7eee commit ee54593
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/display/text_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class TextLayer {

setLayerDimensions(container, viewport);

TextLayer.#pendingTextLayers.add(this);
// Always clean-up the temporary canvas once rendering is no longer pending.
this.#capability.promise
.catch(() => {
Expand Down Expand Up @@ -167,6 +166,7 @@ class TextLayer {
}, this.#capability.reject);
};
this.#reader = this.#textContentSource.getReader();
TextLayer.#pendingTextLayers.add(this);
pump();

return this.#capability.promise;
Expand Down Expand Up @@ -423,6 +423,7 @@ class TextLayer {
return;
}
this.#ascentCache.clear();

for (const { canvas } of this.#canvasContexts.values()) {
canvas.remove();
}
Expand Down

0 comments on commit ee54593

Please sign in to comment.