未验证 提交 c1deafcf 编写于 作者: T Tomáš Matoušek 提交者: GitHub

Fix NRE during InteractiveWindow disposal (#40542)

上级 748d6ab1
......@@ -18,6 +18,7 @@ internal sealed class RemoteService
public readonly Service Service;
private readonly int _processId;
private readonly SemaphoreSlim _disposeSemaphore = new SemaphoreSlim(initialCount: 1);
private readonly bool _joinOutputWritingThreadsOnDisposal;
// output pumping threads (stream output from stdout/stderr of the host process to the output/errorOutput writers)
private InteractiveHost _host; // nulled on dispose
......@@ -31,10 +32,12 @@ internal RemoteService(InteractiveHost host, Process process, int processId, Ser
Debug.Assert(process != null);
Debug.Assert(service != null);
Process = process;
Service = service;
_host = host;
this.Process = process;
_joinOutputWritingThreadsOnDisposal = host._joinOutputWritingThreadsOnDisposal;
_processId = processId;
this.Service = service;
_processExitHandlerStatus = ProcessExitHandlerStatus.Uninitialized;
// TODO (tomat): consider using single-thread async readers
......@@ -140,7 +143,7 @@ internal void Dispose()
InitiateTermination(Process, _processId);
if (_host._joinOutputWritingThreadsOnDisposal)
if (_joinOutputWritingThreadsOnDisposal)
{
try
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册