From cbf35528e1183b2378f12751340c868a6379aef9 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Tue, 9 May 2023 11:09:40 +1000 Subject: [PATCH] fixed memory leaks --- .../idiolect/presentation/toolwindow/chat/ChatTab.kt | 9 ++++----- .../idiolect/presentation/toolwindow/log/SpeechLogTab.kt | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/openasr/idiolect/presentation/toolwindow/chat/ChatTab.kt b/src/main/java/org/openasr/idiolect/presentation/toolwindow/chat/ChatTab.kt index 7e18530..d4059b8 100644 --- a/src/main/java/org/openasr/idiolect/presentation/toolwindow/chat/ChatTab.kt +++ b/src/main/java/org/openasr/idiolect/presentation/toolwindow/chat/ChatTab.kt @@ -32,7 +32,7 @@ import kotlin.reflect.KFunction1 import kotlin.reflect.KMutableProperty0 -class ChatTab(private val toolWindow: ToolWindow) : Disposable, AncestorListener, AiResponseListener { +class ChatTab(private val toolWindow: ToolWindow) : AncestorListener, AiResponseListener { private val log = logger() private val maxLength = 100 private val conversationLog = mutableListOf() @@ -46,7 +46,7 @@ class ChatTab(private val toolWindow: ToolWindow) : Disposable, AncestorListener private val aiService = service() init { - application.messageBus.connect(this).subscribe(AiResponseListener.AI_RESPONSE_TOPIC, this) + application.messageBus.connect().subscribe(AiResponseListener.AI_RESPONSE_TOPIC, this) initialiseLogPane() @@ -56,9 +56,8 @@ class ChatTab(private val toolWindow: ToolWindow) : Disposable, AncestorListener updateModels() } - override fun dispose() { - } - +// override fun dispose() { +// } fun createToolBar(): JComponent { // val group = DefaultActionGroup() diff --git a/src/main/java/org/openasr/idiolect/presentation/toolwindow/log/SpeechLogTab.kt b/src/main/java/org/openasr/idiolect/presentation/toolwindow/log/SpeechLogTab.kt index eceae77..e6f1027 100644 --- a/src/main/java/org/openasr/idiolect/presentation/toolwindow/log/SpeechLogTab.kt +++ b/src/main/java/org/openasr/idiolect/presentation/toolwindow/log/SpeechLogTab.kt @@ -23,7 +23,7 @@ import javax.swing.JTextPane class SpeechLogTab(private val toolWindow: ToolWindow) : - Disposable, +// Disposable, // DumbAware, NlpResultListener { @@ -34,7 +34,7 @@ class SpeechLogTab(private val toolWindow: ToolWindow) : init { - application.messageBus.connect(this).subscribe(NlpResultListener.NLP_RESULT_TOPIC, this) + application.messageBus.connect().subscribe(NlpResultListener.NLP_RESULT_TOPIC, this) // logPane.contentType = UIUtil.HTML_MIME logPane.isEditable = false @@ -46,8 +46,8 @@ class SpeechLogTab(private val toolWindow: ToolWindow) : ".message {color: yellow; margin: 0 0 0 20px;} ") } - override fun dispose() { - } +// override fun dispose() { +// } fun createComponent(): JComponent { val manualEntry = JBTextField(20)