Fixed #8084: rdpei thread alive condition was FALSE

This commit is contained in:
Armin Novak
2022-09-12 21:28:31 +02:00
committed by akallabeth
parent b3f70b047d
commit 320bda4a05

View File

@@ -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);