Skip to content

Commit fe9eb7d

Browse files
committed
Call dispose when atlas is no longer used in cache
Only runtime change is that this clears the bitmap commit timeout in DynamicCharAtlas
1 parent b5f1c33 commit fe9eb7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/renderer/atlas/CharAtlasCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export function acquireCharAtlas(
4242
): BaseCharAtlas {
4343
const newConfig = generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors);
4444

45-
// TODO: Currently if a terminal changes configs it will not free the entry reference (until it's disposed)
46-
4745
// Check to see if the terminal already owns this config
4846
for (let i = 0; i < charAtlasCache.length; i++) {
4947
const entry = charAtlasCache[i];
@@ -54,6 +52,7 @@ export function acquireCharAtlas(
5452
}
5553
// The configs differ, release the terminal from the entry
5654
if (entry.ownedBy.length === 1) {
55+
entry.atlas.dispose();
5756
charAtlasCache.splice(i, 1);
5857
} else {
5958
entry.ownedBy.splice(ownedByIndex, 1);
@@ -94,6 +93,7 @@ export function removeTerminalFromCache(terminal: ITerminal): void {
9493
if (index !== -1) {
9594
if (charAtlasCache[i].ownedBy.length === 1) {
9695
// Remove the cache entry if it's the only terminal
96+
charAtlasCache[i].atlas.dispose();
9797
charAtlasCache.splice(i, 1);
9898
} else {
9999
// Remove the reference from the cache entry

0 commit comments

Comments
 (0)