From 09a73491029dfb579ef39f35a6b189a4c3f73224 Mon Sep 17 00:00:00 2001 From: sharkautarch <128002472+sharkautarch@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:07:48 -0500 Subject: [PATCH] steamcompmgr: fix another coredump-at-exit --- src/Backends/WaylandBackend.cpp | 3 +-- src/steamcompmgr.cpp | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp index c53bf14df1..46074f2143 100644 --- a/src/Backends/WaylandBackend.cpp +++ b/src/Backends/WaylandBackend.cpp @@ -625,8 +625,6 @@ namespace gamescope void Wayland_XXColorManager_SupportedPrimariesNamed( xx_color_manager_v3 *pXXColorManager, uint32_t uPrimaries ); static const xx_color_manager_v3_listener s_XXColorManagerListener; - CWaylandInputThread m_InputThread; - CWaylandConnector m_Connector; CWaylandPlane m_Planes[8]; @@ -688,6 +686,7 @@ namespace gamescope std::atomic m_bDesiredFullscreenState = { false }; bool m_bHostCompositorIsCurrentlyVRR = false; + CWaylandInputThread m_InputThread; }; const wl_registry_listener CWaylandBackend::s_RegistryListener = { diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 8d15bda9d2..996458d945 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -5898,6 +5898,23 @@ error(Display *dpy, XErrorEvent *ev) [[noreturn]] static void steamcompmgr_exit(std::optional> lock = std::nullopt) { + + // Need to clear all the vk_lutxd references (which can be tied to backend-allocated memory) + // for the colormgmt globals/statics, to avoid coredump at exit from within the colormgmt exit-time destructors: + for (auto& colorMgmtArr : + { + std::ref(g_ColorMgmtLuts), + std::ref(g_ColorMgmtLutsOverride), + std::ref(g_ScreenshotColorMgmtLuts), + std::ref(g_ScreenshotColorMgmtLutsHDR) + }) + { + for (auto& colorMgmt : colorMgmtArr.get()) + { + colorMgmt.gamescope_color_mgmt_luts::~gamescope_color_mgmt_luts(); //dtor call also calls all the subobjects' dtors + } + } + g_ImageWaiter.Shutdown(); // Clean up any commits. @@ -5922,7 +5939,6 @@ steamcompmgr_exit(std::optional> lock = std::nullop { g_ColorMgmt.pending.appHDRMetadata = nullptr; g_ColorMgmt.current.appHDRMetadata = nullptr; - s_scRGB709To2020Matrix = nullptr; for (int i = 0; i < gamescope::GAMESCOPE_SCREEN_TYPE_COUNT; i++) {