mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix listener leak on settings close
GitOrigin-RevId: 5001f015e65dc339ccccfc2d6c782749b03bcc8a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
502032aa69
commit
0be5ad3d6e
+8
-4
@@ -10,12 +10,14 @@ import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.options.ShowSettingsUtil
|
||||
import com.intellij.openapi.options.ex.Settings
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.messages.MessageBusConnection
|
||||
import javax.swing.JComponent
|
||||
|
||||
class InlayHintsConfigurable(val project: Project) : Configurable, Configurable.Composite {
|
||||
private val settings = InlayHintsSettings.instance()
|
||||
private val configurables: List<SingleLanguageInlayHintsConfigurable>
|
||||
private val panel: InlayHintsPanel
|
||||
private val connection: MessageBusConnection
|
||||
|
||||
init {
|
||||
val allInlayLanguages = InlaySettingsProvider.EP.getExtensions()
|
||||
@@ -24,16 +26,14 @@ class InlayHintsConfigurable(val project: Project) : Configurable, Configurable.
|
||||
configurables = allInlayLanguages.map { SingleLanguageInlayHintsConfigurable(project, it) }
|
||||
panel = InlayHintsPanel(allInlayLanguages, settings)
|
||||
|
||||
ApplicationManager.getApplication().messageBus.connect(project).subscribe(
|
||||
InlayHintsSettings.INLAY_SETTINGS_CHANGED,
|
||||
ConfigurationChangeListener(configurables))
|
||||
connection = ApplicationManager.getApplication().messageBus.connect(project)
|
||||
connection.subscribe(InlayHintsSettings.INLAY_SETTINGS_CHANGED, ConfigurationChangeListener(configurables))
|
||||
}
|
||||
|
||||
override fun getConfigurables(): Array<Configurable> {
|
||||
return configurables.toTypedArray()
|
||||
}
|
||||
|
||||
|
||||
override fun isModified(): Boolean {
|
||||
return panel.isModified()
|
||||
}
|
||||
@@ -54,6 +54,10 @@ class InlayHintsConfigurable(val project: Project) : Configurable, Configurable.
|
||||
panel.reset()
|
||||
}
|
||||
|
||||
override fun disposeUIResources() {
|
||||
connection.disconnect()
|
||||
}
|
||||
|
||||
fun loadFromSettings() {
|
||||
for (configurable in configurables) {
|
||||
configurable.reset()
|
||||
|
||||
Reference in New Issue
Block a user