Skip to content

Commit

Permalink
fix: dispose canvas renderer before terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Sep 13, 2023
1 parent 5e3ec17 commit 0be990b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/renderer/compositions/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,19 @@ export function handleTerminalMessages() {
const tab = tabs.find(item => item.pid === data.pid)
if (!tab) return
tab.deferred.stop.resolve()
// FIXME: xterm-addon-webgl cannot dispose correctly
// FIXME: renderer cannot dispose correctly since the `dispose` will set a new DomRenderer
// which could not be finished when the terminal is disposed
if (tab.addons.webgl) {
tab.addons.webgl.dispose()
delete tab.addons.webgl
}
if (tab.addons.canvas) {
tab.addons.canvas.dispose()
delete tab.addons.canvas
}
const xterm = tab.xterm
// FIXME: clear paused resize task manually to remove renderer as dependency
xterm['_core']._renderService._pausedResizeTask.set(() => {})
xterm.dispose()
removeTerminalTab(tab)
})
Expand Down

0 comments on commit 0be990b

Please sign in to comment.