Cygwin: pty: Fix acquiring attach_mutex timing.
- When temporarily attaching a console, the timing of acquiring attach_mutex was not appropriate. This sometimes caused master forwarding thread to crash on Ctrl-C in Windows 7. This patch fixes the issue.
This commit is contained in:
parent
aa9b5262f2
commit
b29fd96cac
|
@ -4171,13 +4171,13 @@ DWORD
|
|||
fhandler_pty_common::attach_console_temporarily (DWORD target_pid)
|
||||
{
|
||||
DWORD resume_pid = 0;
|
||||
acquire_attach_mutex (mutex_timeout);
|
||||
pinfo pinfo_resume (myself->ppid);
|
||||
if (pinfo_resume)
|
||||
resume_pid = pinfo_resume->dwProcessId;
|
||||
if (!resume_pid)
|
||||
resume_pid = get_console_process_id (myself->dwProcessId, false);
|
||||
bool console_exists = fhandler_console::exists ();
|
||||
acquire_attach_mutex (mutex_timeout);
|
||||
if (!console_exists || resume_pid)
|
||||
{
|
||||
FreeConsole ();
|
||||
|
|
Loading…
Reference in New Issue