fix: 修复可能导致内存泄漏的问题

This commit is contained in:
hstyi
2025-01-15 15:13:09 +08:00
committed by hstyi
parent 1476368673
commit 21cf22906b
2 changed files with 3 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ class HostTreeDialog(
title = I18n.getString("termora.transport.sftp.select-host") title = I18n.getString("termora.transport.sftp.select-host")
tree.setModel(SearchableHostTreeModel(tree.model) { host -> tree.setModel(SearchableHostTreeModel(tree.model) { host ->
host.protocol == Protocol.Folder || host.protocol == Protocol.SSH (host.protocol == Protocol.Folder || host.protocol == Protocol.SSH) && filter.invoke(host)
}) })
tree.contextmenu = true tree.contextmenu = true
tree.doubleClickConnection = false tree.doubleClickConnection = false
@@ -73,6 +73,7 @@ class HostTreeDialog(
addWindowListener(object : WindowAdapter() { addWindowListener(object : WindowAdapter() {
override fun windowClosed(e: WindowEvent) { override fun windowClosed(e: WindowEvent) {
tree.setModel(null)
Database.getDatabase().properties.putString( Database.getDatabase().properties.putString(
"HostTreeDialog.HostTreeExpansionState", "HostTreeDialog.HostTreeExpansionState",
TreeUtils.saveExpansionState(tree) TreeUtils.saveExpansionState(tree)

View File

@@ -229,6 +229,7 @@ class WelcomePanel(private val windowScope: WindowScope) : JPanel(BorderLayout()
} }
override fun dispose() { override fun dispose() {
hostTree.setModel(null)
properties.putString("WelcomeFullContent", fullContent.toString()) properties.putString("WelcomeFullContent", fullContent.toString())
} }