[client] fix shutdown race condition with the frame thread

This commit is contained in:
Geoffrey McRae 2019-08-30 11:50:43 +10:00
parent da94075e7b
commit e93bd7a3bf
3 changed files with 11 additions and 8 deletions

View File

@ -1 +1 @@
fetch-2-g69522495de+1
fetch-4-gf7d2295dab+1

View File

@ -155,7 +155,12 @@ static int renderThread(void * unused)
}
state.running = false;
SDL_WaitThread(t_cursor, NULL);
if (t_cursor)
SDL_WaitThread(t_cursor, NULL);
if (state.t_frame)
SDL_WaitThread(state.t_frame, NULL);
state.lgr->deinitialize(state.lgrData);
state.lgr = NULL;
@ -1204,7 +1209,6 @@ int run()
}
SDL_Thread *t_spice = NULL;
SDL_Thread *t_frame = NULL;
SDL_Thread *t_render = NULL;
while(1)
@ -1284,7 +1288,7 @@ int run()
break;
}
if (!(t_frame = SDL_CreateThread(frameThread, "frameThread", NULL)))
if (!(state.t_frame = SDL_CreateThread(frameThread, "frameThread", NULL)))
{
DEBUG_ERROR("frame create thread failed");
break;
@ -1326,9 +1330,6 @@ int run()
if (t_render)
SDL_WaitThread(t_render, NULL);
if (t_frame)
SDL_WaitThread(t_frame, NULL);
// if spice is still connected send key up events for any pressed keys
if (params.useSpiceInput && spice_ready())
{

View File

@ -49,6 +49,8 @@ struct AppState
void * lgrData;
bool lgrResize;
SDL_Thread * t_frame;
const LG_Clipboard * lgc;
SpiceDataType cbType;
struct ll * cbRequestList;
@ -130,4 +132,4 @@ struct KeybindHandle
// forwards
extern struct AppState state;
extern struct AppParams params;
extern struct AppParams params;