(CoroutineDebugger) Memory leak fixed on IDEA quit: 'org.jetbrains.kotlin.idea.debugger.coroutine.view.XCoroutineView
#KT-40386 fixed
This commit is contained in:
+10
-12
@@ -35,8 +35,7 @@ class DebuggerConnection(
|
||||
val params: JavaParameters?,
|
||||
val runnerSettings: DebuggingRunnerData?,
|
||||
modifyArgs: Boolean = true
|
||||
) : XDebuggerManagerListener {
|
||||
var disposable: Disposable? = null
|
||||
) : XDebuggerManagerListener, Disposable {
|
||||
var connection: MessageBusConnection? = null
|
||||
private val log by logger
|
||||
|
||||
@@ -87,21 +86,15 @@ class DebuggerConnection(
|
||||
override fun processStarted(debugProcess: XDebugProcess) {
|
||||
DebuggerInvocationUtil.swingInvokeLater(project) {
|
||||
if (debugProcess is JavaDebugProcess) {
|
||||
disposable = registerXCoroutinesPanel(debugProcess.session)
|
||||
registerXCoroutinesPanel(debugProcess.session)?.let {
|
||||
Disposer.register(this, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processStopped(debugProcess: XDebugProcess) {
|
||||
val rootDisposable = disposable
|
||||
if (rootDisposable is Disposable && debugProcess is JavaDebugProcess && debugProcess.session.suspendContext is SuspendContextImpl) {
|
||||
ManagerThreadExecutor(debugProcess).on(debugProcess.session.suspendContext).invoke {
|
||||
Disposer.dispose(rootDisposable)
|
||||
disposable = null
|
||||
}
|
||||
}
|
||||
connection?.disconnect()
|
||||
connection = null
|
||||
Disposer.dispose(this)
|
||||
}
|
||||
|
||||
private fun registerXCoroutinesPanel(session: XDebugSession): Disposable? {
|
||||
@@ -119,6 +112,11 @@ class DebuggerConnection(
|
||||
val param = createContentParamProvider.createContentParams()
|
||||
return ui.createContent(param.id, param.component, param.displayName, param.icon, param.parentComponent)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
connection?.disconnect()
|
||||
connection = null
|
||||
}
|
||||
}
|
||||
|
||||
enum class CoroutineDebuggerMode {
|
||||
|
||||
Reference in New Issue
Block a user