CORPRIV-665: Protect NodeTerminalView from being destroyed twice.

This commit is contained in:
Chris Rankin 2017-02-09 17:14:49 +00:00
parent ccfbfde830
commit 975bba0295
2 changed files with 10 additions and 6 deletions

View File

@ -185,7 +185,7 @@ class NodeTabView : Fragment() {
if (config != null) {
nodeConfigView.isVisible = false
nodeTab.text = config.legalName
nodeTerminalView.open(config, onExit = { onTabClose(config) })
nodeTerminalView.open(config, onExit = { onTerminalExit(config) })
nodeTab.setOnSelectionChanged {
if (nodeTab.isSelected) {
@ -196,7 +196,7 @@ class NodeTabView : Fragment() {
}
}
private fun onTabClose(config: NodeConfig) {
private fun onTerminalExit(config: NodeConfig) {
Platform.runLater {
nodeTab.requestClose()
nodeController.dispose(config)

View File

@ -33,6 +33,7 @@ class NodeTerminalView : Fragment() {
private val viewDatabaseButton by fxid<Button>()
private val launchExplorerButton by fxid<Button>()
private var isClosed: Boolean = false
private val explorer = explorerController.explorer()
private val viewer = DBViewer()
private var rpc: NodeRPC? = null
@ -114,10 +115,13 @@ class NodeTerminalView : Fragment() {
})
fun close() {
explorer.close()
viewer.close()
rpc?.close()
pty?.close()
if (!isClosed) {
explorer.close()
viewer.close()
rpc?.close()
pty?.close()
isClosed = true
}
}
fun refreshTerminal() {