Skip to content

Commit

Permalink
steamcompmgr: Always shutdown before wlserver
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad committed Apr 10, 2024
1 parent b93b576 commit 39f2779
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6047,7 +6047,7 @@ steamcompmgr_exit(void)
gamescope::IBackend::Set( nullptr );

wlserver_lock();
wlserver_force_shutdown();
wlserver_shutdown();
wlserver_unlock(false);

pthread_exit(NULL);
Expand Down
8 changes: 6 additions & 2 deletions src/wlserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,7 @@ void wlserver_unlock(bool flush)
extern std::mutex g_SteamCompMgrXWaylandServerMutex;

static int g_wlserverNudgePipe[2] = {-1, -1};
static std::atomic<bool> g_bShutdownWLServer{ false };

void wlserver_run(void)
{
Expand All @@ -1747,7 +1748,8 @@ void wlserver_run(void)
},
};

while ( g_bRun ) {
while ( !g_bShutdownWLServer )
{
int ret = poll( pollfds, 2, -1 );

if ( ret < 0 ) {
Expand Down Expand Up @@ -1798,10 +1800,12 @@ void wlserver_run(void)
wlserver_unlock(false);
}

void wlserver_force_shutdown()
void wlserver_shutdown()
{
assert( wlserver_is_lock_held() );

g_bShutdownWLServer = true;

if (wlserver.display)
{
if ( write( g_wlserverNudgePipe[ 1 ], "\n", 1 ) < 0 )
Expand Down
2 changes: 1 addition & 1 deletion src/wlserver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void wlserver_presentation_feedback_discard( struct wlr_surface *surface, std::v
void wlserver_past_present_timing( struct wlr_surface *surface, uint32_t present_id, uint64_t desired_present_time, uint64_t actual_present_time, uint64_t earliest_present_time, uint64_t present_margin );
void wlserver_refresh_cycle( struct wlr_surface *surface, uint64_t refresh_cycle );

void wlserver_force_shutdown();
void wlserver_shutdown();

void wlserver_send_gamescope_control( wl_resource *control );

Expand Down

0 comments on commit 39f2779

Please sign in to comment.