wlserver: Wait for steamcompmgr to shutdown before cleaning up xwayland

Makes shutdown cleaner
This commit is contained in:
Joshua Ashton 2022-01-20 08:55:26 +00:00
parent edb77e2490
commit 57eee35f29
2 changed files with 8 additions and 0 deletions

View file

@ -213,6 +213,8 @@ extern bool g_bIntegerScale;
bool synchronize;
std::mutex g_SteamCompMgrXWaylandServerMutex;
enum HeldCommitTypes_t
{
HELD_COMMIT_BASE,
@ -4286,6 +4288,8 @@ steamcompmgr_main(int argc, char **argv)
int vblankFD = vblank_init();
assert( vblankFD >= 0 );
std::unique_lock<std::mutex> xwayland_server_guard(g_SteamCompMgrXWaylandServerMutex);
// Initialize any xwayland ctxs we have
{
gamescope_xwayland_server_t *server = NULL;

View file

@ -817,6 +817,8 @@ void wlserver_unlock(void)
pthread_mutex_unlock(&waylock);
}
extern std::mutex g_SteamCompMgrXWaylandServerMutex;
void wlserver_run(void)
{
struct pollfd pollfd = {
@ -851,6 +853,8 @@ void wlserver_run(void)
}
}
// Released when steamcompmgr closes.
std::unique_lock<std::mutex> xwayland_server_guard(g_SteamCompMgrXWaylandServerMutex);
// We need to shutdown Xwayland before disconnecting all clients, otherwise
// wlroots will restart it automatically.
wlserver.wlr.xwayland_servers.clear();