Skip to content

Commit

Permalink
Call dispose when atlas is no longer used in cache
Browse files Browse the repository at this point in the history
Only runtime change is that this clears the bitmap commit timeout
in DynamicCharAtlas
  • Loading branch information
Tyriar committed Dec 9, 2018
1 parent b5f1c33 commit fe9eb7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/renderer/atlas/CharAtlasCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export function acquireCharAtlas(
): BaseCharAtlas {
const newConfig = generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors);

// TODO: Currently if a terminal changes configs it will not free the entry reference (until it's disposed)

// Check to see if the terminal already owns this config
for (let i = 0; i < charAtlasCache.length; i++) {
const entry = charAtlasCache[i];
Expand All @@ -54,6 +52,7 @@ export function acquireCharAtlas(
}
// The configs differ, release the terminal from the entry
if (entry.ownedBy.length === 1) {
entry.atlas.dispose();
charAtlasCache.splice(i, 1);
} else {
entry.ownedBy.splice(ownedByIndex, 1);
Expand Down Expand Up @@ -94,6 +93,7 @@ export function removeTerminalFromCache(terminal: ITerminal): void {
if (index !== -1) {
if (charAtlasCache[i].ownedBy.length === 1) {
// Remove the cache entry if it's the only terminal
charAtlasCache[i].atlas.dispose();
charAtlasCache.splice(i, 1);
} else {
// Remove the reference from the cache entry
Expand Down

0 comments on commit fe9eb7d

Please sign in to comment.