Skip to content

Commit

Permalink
steamcompmgr: Fix some shutdown hangs
Browse files Browse the repository at this point in the history
Based on #1335
  • Loading branch information
misyltoad committed Dec 16, 2024
1 parent 3821e4b commit ff45361
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/rendervulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ struct gamescope_color_mgmt_luts
return bHasLut3D && bHasLut1D;
}

void shutdown()
{
bHasLut1D = false;
bHasLut3D = false;
vk_lut1d = nullptr;
vk_lut3d = nullptr;
}

void reset()
{
bHasLut1D = false;
Expand Down
14 changes: 10 additions & 4 deletions src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5895,7 +5895,7 @@ error(Display *dpy, XErrorEvent *ev)
return 0;
}

[[noreturn]] static void
static void
steamcompmgr_exit(void)
{
g_ImageWaiter.Shutdown();
Expand All @@ -5913,6 +5913,11 @@ steamcompmgr_exit(void)
g_HeldCommits[ HELD_COMMIT_BASE ] = nullptr;
g_HeldCommits[ HELD_COMMIT_FADE ] = nullptr;

for ( auto &lut : g_ColorMgmtLuts ) lut.shutdown();
for ( auto &lut : g_ColorMgmtLutsOverride ) lut.shutdown();
for ( auto &lut : g_ScreenshotColorMgmtLuts ) lut.shutdown();
for ( auto &lut : g_ScreenshotColorMgmtLutsHDR ) lut.shutdown();

if ( statsThreadRun == true )
{
statsThreadRun = false;
Expand All @@ -5936,15 +5941,16 @@ steamcompmgr_exit(void)
wlserver_lock();
wlserver_shutdown();
wlserver_unlock(false);

pthread_exit(NULL);
}

static int
[[noreturn]] static int
handle_io_error(Display *dpy)
{
xwm_log.errorf("X11 I/O error");
steamcompmgr_exit();

g_SteamCompMgrXWaylandServerMutex.unlock();
pthread_exit(NULL);
}

static bool
Expand Down

0 comments on commit ff45361

Please sign in to comment.