From 3f42e83207c76797a60880d6ba61279681a869c3 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Tue, 24 May 2016 16:33:23 -0500 Subject: [PATCH] Ensure that the agent aborts if the console window is NULL It should guard against a recurrence of https://youtrack.jetbrains.com/issue/IDEA-156228. --- src/agent/Agent.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/agent/Agent.cc b/src/agent/Agent.cc index 4b3cc86..869ecb3 100644 --- a/src/agent/Agent.cc +++ b/src/agent/Agent.cc @@ -128,6 +128,13 @@ Agent::Agent(LPCWSTR controlPipeName, { trace("Agent::Agent entered"); + // The console window must be non-NULL. It is used for two purposes: + // (1) "Freezing" the console to detect the exact number of lines that + // have scrolled. + // (2) Killing processes attached to the console, by posting a WM_CLOSE + // message to the console window. + ASSERT(GetConsoleWindow() != nullptr); + m_bufferData.resize(BUFFER_LINE_COUNT); m_console = new Win32Console;