Explicitly disconnect in KotlinPackageContentModificationListener (KT-33802)
This commit is contained in:
+7
-3
@@ -47,10 +47,10 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.ConcurrentMap
|
||||
|
||||
class KotlinPackageContentModificationListener(private val project: Project) {
|
||||
init {
|
||||
val connection = project.messageBus.connect()
|
||||
class KotlinPackageContentModificationListener(private val project: Project): Disposable {
|
||||
val connection = project.messageBus.connect()
|
||||
|
||||
init {
|
||||
connection.subscribe(VirtualFileManager.VFS_CHANGES, object : BulkFileListener {
|
||||
override fun before(events: MutableList<out VFileEvent>) = onEvents(events)
|
||||
override fun after(events: List<VFileEvent>) = onEvents(events)
|
||||
@@ -82,6 +82,10 @@ class KotlinPackageContentModificationListener(private val project: Project) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
connection.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinPackageStatementPsiTreeChangePreprocessor(private val project: Project) : PsiTreeChangePreprocessor {
|
||||
|
||||
Reference in New Issue
Block a user