From: Jacek Caban Subject: Re: [PATCH] conhost: Input should be restored and input_thread handle should be closed before return. Message-Id: <13e644f0-a8b7-b49f-538b-81a517b18825@codeweavers.com> Date: Tue, 22 Sep 2020 14:26:39 +0200 In-Reply-To: <22b1dec7.41b4.174b47e0da2.Coremail.yhd986@163.com> References: <22b1dec7.41b4.174b47e0da2.Coremail.yhd986@163.com> On 22.09.2020 08:26, Haidong Yu wrote: > + if (console->is_unix) > + { > + unsigned int h = 0; > + status = NtDeviceIoControlFile(console->server, NULL, NULL, NULL, &io, IOCTL_CONDRV_SETUP_INPUT, > + &h, sizeof(h), NULL, 0); > + if (status) ERR( "input restore failed: %#x\n", status ); > + } > + CloseHandle( console->input_thread ); > + console->input_thread = NULL; We should probably also terminate current read, like we do in the end of the function. Please break out of the loop instead of duplicating that code. Thanks, Jacek