From 86be7d1c966604ae34fa9f687053c76dbf5bfc73 Mon Sep 17 00:00:00 2001 From: Maksim Zuev Date: Mon, 2 Feb 2026 09:50:30 +0100 Subject: [PATCH] [debugger] IDEA-385383 Store VM as hard reference as nobody could keep another hard reference to it GitOrigin-RevId: e3d05624fd2582fc12b6737e597eea4da72956b9 --- .../intellij/debugger/engine/DebuggerManagerThreadImpl.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.kt b/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.kt index 0af781153249..f2b79fd1b36f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.kt +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.kt @@ -52,7 +52,6 @@ import kotlinx.coroutines.withContext import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.Nls import org.jetbrains.annotations.TestOnly -import java.lang.ref.WeakReference import java.util.ArrayDeque import java.util.concurrent.CompletableFuture import java.util.concurrent.TimeUnit @@ -68,11 +67,11 @@ class DebuggerManagerThreadImpl @ApiStatus.Internal constructor( private var myDisposed = false internal val debuggerThreadDispatcher = DebuggerThreadDispatcher(this) - private var _vmProxy = WeakReference(null) + private var _vmProxy: VirtualMachineProxyImpl? = null @get:ApiStatus.Internal val vmProxy: VirtualMachineProxyImpl? - get() = _vmProxy.get() + get() = _vmProxy @ApiStatus.Internal fun setVmProxy(proxy: VirtualMachineProxyImpl?) { @@ -80,7 +79,7 @@ class DebuggerManagerThreadImpl @ApiStatus.Internal constructor( if (current != null && proxy != null && current.virtualMachine !== proxy.virtualMachine) { LOG.error("VM proxy changed from $current to $proxy") } - _vmProxy = WeakReference(proxy) + _vmProxy = proxy } @ApiStatus.Internal