Skip to content

Commit

Permalink
sdlwindow.cpp: close m_thread w/o std::terminate being called
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkautarch committed May 24, 2024
1 parent 420eb91 commit 35f5ba8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/sdlwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace gamescope
GAMESCOPE_SDL_EVENT_CURSOR,

GAMESCOPE_SDL_EVENT_COUNT,
GAMESCOPE_SDL_EVENT_REQ_EXIT,
};

class CSDLConnector final : public IBackendConnector
Expand Down Expand Up @@ -111,6 +112,7 @@ namespace gamescope
{
public:
CSDLBackend();
~CSDLBackend();

/////////////
// IBackend
Expand Down Expand Up @@ -548,7 +550,12 @@ namespace gamescope
{
// Do nothing.
}


CSDLBackend::~CSDLBackend() {
PushUserEvent(GAMESCOPE_SDL_EVENT_REQ_EXIT);
m_SDLThread.join();
}

void CSDLBackend::SDLThreadFunc()
{
pthread_setname_np( pthread_self(), "gamescope-sdl" );
Expand Down Expand Up @@ -944,6 +951,9 @@ namespace gamescope

SDL_SetCursor( m_pCursor );
}
else if ( event.type == GetUserEventIndex( GAMESCOPE_SDL_EVENT_REQ_EXIT ) ) {
return;
}
}
break;
}
Expand Down

0 comments on commit 35f5ba8

Please sign in to comment.