[client] spice: fix spice shutdown race

Fixes #960
This commit is contained in:
Geoffrey McRae 2022-05-15 16:28:37 +10:00
parent 0a9a9ed57e
commit 32fbcaffd2

View File

@ -920,6 +920,19 @@ int spiceThread(void * arg)
}
}
// send key up events for any pressed keys
if (g_params.useSpiceInput)
{
for(int scancode = 0; scancode < KEY_MAX; ++scancode)
if (g_state.keyDown[scancode])
{
g_state.keyDown[scancode] = false;
purespice_keyUp(scancode);
}
}
purespice_disconnect();
end:
audio_free();
@ -1540,6 +1553,10 @@ restart:
static void lg_shutdown(void)
{
g_state.state = APP_STATE_SHUTDOWN;
if (t_spice)
lgJoinThread(t_spice, NULL);
if (t_render)
{
if (g_state.jitRender && g_state.ds->stopWaitFrame)
@ -1563,21 +1580,6 @@ static void lg_shutdown(void)
e_startup = NULL;
}
// if spice is still connected send key up events for any pressed keys
if (g_params.useSpiceInput)
{
for(int scancode = 0; scancode < KEY_MAX; ++scancode)
if (g_state.keyDown[scancode])
{
g_state.keyDown[scancode] = false;
purespice_keyUp(scancode);
}
purespice_disconnect();
if (t_spice)
lgJoinThread(t_spice, NULL);
}
if (g_state.ds)
g_state.ds->shutdown();