diff --git a/src/main/kotlin/app/termora/HostTerminalTab.kt b/src/main/kotlin/app/termora/HostTerminalTab.kt index 16267a1..1adb70c 100644 --- a/src/main/kotlin/app/termora/HostTerminalTab.kt +++ b/src/main/kotlin/app/termora/HostTerminalTab.kt @@ -5,6 +5,7 @@ import app.termora.actions.DataProviders import app.termora.terminal.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancel import kotlinx.coroutines.swing.Swing import java.beans.PropertyChangeEvent @@ -19,7 +20,7 @@ abstract class HostTerminalTab( val Host = DataKey(app.termora.Host::class) } - protected val coroutineScope by lazy { CoroutineScope(Dispatchers.Swing) } + protected val coroutineScope by lazy { CoroutineScope(SupervisorJob() + Dispatchers.Swing) } protected val terminalModel get() = terminal.getTerminalModel() protected var unread = false set(value) { diff --git a/src/main/kotlin/app/termora/TerminalPanelFactory.kt b/src/main/kotlin/app/termora/TerminalPanelFactory.kt index 9feec3a..8a501dc 100644 --- a/src/main/kotlin/app/termora/TerminalPanelFactory.kt +++ b/src/main/kotlin/app/termora/TerminalPanelFactory.kt @@ -89,7 +89,7 @@ class TerminalPanelFactory : Disposable { } } - private val coroutineScope = CoroutineScope(Dispatchers.IO) + private val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) init { coroutineScope.launch { diff --git a/src/main/kotlin/app/termora/keymgr/SSHCopyIdDialog.kt b/src/main/kotlin/app/termora/keymgr/SSHCopyIdDialog.kt index faa52d4..fc74eac 100644 --- a/src/main/kotlin/app/termora/keymgr/SSHCopyIdDialog.kt +++ b/src/main/kotlin/app/termora/keymgr/SSHCopyIdDialog.kt @@ -43,7 +43,7 @@ class SSHCopyIdDialog( terminalPanelFactory.createTerminalPanel(terminal, PtyConnectorDelegate()) .apply { enableFloatingToolbar = false } } - private val coroutineScope = CoroutineScope(Job() + Dispatchers.IO) + private val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) init { size = Dimension(UIManager.getInt("Dialog.width") - 100, UIManager.getInt("Dialog.height") - 100) diff --git a/src/main/kotlin/app/termora/terminal/panel/TerminalBlink.kt b/src/main/kotlin/app/termora/terminal/panel/TerminalBlink.kt index 6c2e1a7..c054a09 100644 --- a/src/main/kotlin/app/termora/terminal/panel/TerminalBlink.kt +++ b/src/main/kotlin/app/termora/terminal/panel/TerminalBlink.kt @@ -93,7 +93,7 @@ class TerminalBlink(terminal: Terminal) : Disposable { } } - val coroutineScope by lazy { CoroutineScope(Dispatchers.IO) } + val coroutineScope by lazy { CoroutineScope(SupervisorJob() + Dispatchers.IO) } /** * 返回 true 表示可以显示某些内容 [TextStyle.blink] diff --git a/src/main/kotlin/app/termora/terminal/panel/vw/AutoRefreshPanel.kt b/src/main/kotlin/app/termora/terminal/panel/vw/AutoRefreshPanel.kt index 4b8831a..296b577 100644 --- a/src/main/kotlin/app/termora/terminal/panel/vw/AutoRefreshPanel.kt +++ b/src/main/kotlin/app/termora/terminal/panel/vw/AutoRefreshPanel.kt @@ -11,7 +11,7 @@ abstract class AutoRefreshPanel : JPanel(), Disposable { private val log = LoggerFactory.getLogger(AutoRefreshPanel::class.java) } - protected val coroutineScope = CoroutineScope(Dispatchers.IO) + protected val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) protected abstract suspend fun refresh(isFirst: Boolean) diff --git a/src/main/kotlin/app/termora/tlog/TerminalLoggerDataListener.kt b/src/main/kotlin/app/termora/tlog/TerminalLoggerDataListener.kt index 39b285d..2e48ef7 100644 --- a/src/main/kotlin/app/termora/tlog/TerminalLoggerDataListener.kt +++ b/src/main/kotlin/app/termora/tlog/TerminalLoggerDataListener.kt @@ -110,7 +110,8 @@ class TerminalLoggerDataListener(private val terminal: Terminal) : DataListener action.removePropertyChangeListener(terminalLoggerActionPropertyChangeListener) action.addPropertyChangeListener(terminalLoggerActionPropertyChangeListener) - val coroutineScope = this.coroutineScope ?: CoroutineScope(Dispatchers.IO).apply { coroutineScope = this } + val coroutineScope = + this.coroutineScope ?: CoroutineScope(SupervisorJob() + Dispatchers.IO).apply { coroutineScope = this } val channel = this.channel ?: Channel(Channel.UNLIMITED).apply { channel = this } coroutineScope.launch {