mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-11-04 06:31:54 +00:00 
			
		
		
		
	[client] fix shutdown race condition with the frame thread
This commit is contained in:
		@@ -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())
 | 
			
		||||
  {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
		Reference in New Issue
	
	Block a user