From 0be990b24ea80f1d012567022bb270e161ce53e1 Mon Sep 17 00:00:00 2001 From: CyanSalt Date: Wed, 13 Sep 2023 14:39:00 +0800 Subject: [PATCH] fix: dispose canvas renderer before terminal --- src/renderer/compositions/terminal.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderer/compositions/terminal.ts b/src/renderer/compositions/terminal.ts index 82b1648c..6cf79759 100644 --- a/src/renderer/compositions/terminal.ts +++ b/src/renderer/compositions/terminal.ts @@ -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) })