steamcompmgr: Ensure wlserver + sdlwindow shutdown on exit

This commit is contained in:
Joshua Ashton 2023-10-01 01:47:57 +01:00
parent 31da8c1ef5
commit 1616ac6478
3 changed files with 15 additions and 0 deletions

View file

@ -463,11 +463,14 @@ void inputSDLThreadRun( void )
}
}
pthread_t sdlwindow_thread = {};
bool sdlwindow_init( void )
{
g_SDLInitLock.lock();
std::thread inputSDLThread( inputSDLThreadRun );
sdlwindow_thread = inputSDLThread.native_handle();
inputSDLThread.detach();
// When this returns SDL_Init should be over
@ -476,6 +479,11 @@ bool sdlwindow_init( void )
return g_bSDLInitOK;
}
void sdlwindow_shutdown( void )
{
pthread_cancel(sdlwindow_thread);
}
void sdlwindow_title( std::shared_ptr<std::string> title, std::shared_ptr<std::vector<uint32_t>> icon )
{
if ( !BIsSDLSession() )

View file

@ -9,6 +9,7 @@
#define PRIMARYSELECTION 1
bool sdlwindow_init( void );
void sdlwindow_shutdown( void );
void sdlwindow_update( void );
void sdlwindow_title( std::shared_ptr<std::string> title, std::shared_ptr<std::vector<uint32_t>> icon );

View file

@ -5847,6 +5847,12 @@ steamcompmgr_exit(void)
statsThreadSem.signal();
}
sdlwindow_shutdown();
wlserver_lock();
wlserver_force_shutdown();
wlserver_unlock(false);
finish_drm( &g_DRM );
pthread_exit(NULL);