Fixed async-input quit

This commit is contained in:
Armin Novak 2021-05-19 09:17:34 +02:00 committed by akallabeth
parent 6f2c6625e4
commit 1d53117508

View File

@ -1401,11 +1401,8 @@ static DWORD WINAPI xf_input_thread(LPVOID arg)
DWORD status; DWORD status;
DWORD nCount; DWORD nCount;
HANDLE events[3]; HANDLE events[3];
XEvent xevent;
wMessage msg; wMessage msg;
wMessageQueue* queue; wMessageQueue* queue;
int pending_status = 1;
int process_status = 1;
freerdp* instance = (freerdp*)arg; freerdp* instance = (freerdp*)arg;
xfContext* xfc = (xfContext*)instance->context; xfContext* xfc = (xfContext*)instance->context;
queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE); queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
@ -1434,26 +1431,7 @@ static DWORD WINAPI xf_input_thread(LPVOID arg)
if (WaitForSingleObject(events[1], 0) == WAIT_OBJECT_0) if (WaitForSingleObject(events[1], 0) == WAIT_OBJECT_0)
{ {
do if (!xf_process_x_events(xfc->context.instance))
{
xf_lock_x11(xfc);
pending_status = XPending(xfc->display);
xf_unlock_x11(xfc);
if (pending_status)
{
xf_lock_x11(xfc);
ZeroMemory(&xevent, sizeof(xevent));
XNextEvent(xfc->display, &xevent);
process_status = xf_event_process(instance, &xevent);
xf_unlock_x11(xfc);
if (!process_status)
break;
}
} while (pending_status);
if (!process_status)
{ {
running = FALSE; running = FALSE;
break; break;
@ -1472,6 +1450,7 @@ static DWORD WINAPI xf_input_thread(LPVOID arg)
} }
MessageQueue_PostQuit(queue, 0); MessageQueue_PostQuit(queue, 0);
freerdp_abort_connect(xfc->context.instance);
ExitThread(0); ExitThread(0);
return 0; return 0;
} }