From 320bda4a0508ff4bdc7203aaeb78eb3c2f9fd59c Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 12 Sep 2022 21:28:31 +0200 Subject: [PATCH] Fixed #8084: rdpei thread alive condition was FALSE --- channels/rdpei/client/rdpei_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/channels/rdpei/client/rdpei_main.c b/channels/rdpei/client/rdpei_main.c index fdccb9f03..54f978108 100644 --- a/channels/rdpei/client/rdpei_main.c +++ b/channels/rdpei/client/rdpei_main.c @@ -86,6 +86,7 @@ typedef struct rdpContext* rdpcontext; HANDLE thread; HANDLE event; + BOOL running; } RDPEI_PLUGIN; /** @@ -448,7 +449,7 @@ static DWORD WINAPI rdpei_periodic_update(LPVOID arg) goto out; } - while (rdpei->base.initialized) + while (rdpei->running) { status = WaitForSingleObject(rdpei->event, 20); @@ -479,6 +480,9 @@ out: if (error && rdpei && rdpei->rdpcontext) setChannelError(rdpei->rdpcontext, error, "rdpei_schedule_thread reported an error"); + if (rdpei) + rdpei->running = FALSE; + ExitThread(error); return error; } @@ -1359,6 +1363,7 @@ static UINT init_plugin_cb(GENERIC_DYNVC_PLUGIN* base, rdpContext* rcontext, rdp rdpei->context = context; rdpei->base.iface.pInterface = (void*)context; + rdpei->running = TRUE; rdpei->thread = CreateThread(NULL, 0, rdpei_periodic_update, rdpei, 0, NULL); if (!rdpei->thread) { @@ -1374,6 +1379,7 @@ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base) RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*)base; WINPR_ASSERT(rdpei); + rdpei->running = FALSE; if (rdpei->event) SetEvent(rdpei->event);