From 5916bb2ce5752db1865cf7c4ec63806762082d41 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 25 Oct 2023 07:52:00 +0100 Subject: [PATCH] steamcompmgr: Fix race when sending refresh cycle --- src/steamcompmgr.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 349c091064..3bc73de13f 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -6221,18 +6221,21 @@ void handle_presented_for_window( steamcompmgr_win_t* w ) if (struct wlr_surface *surface = w->current_surface()) { auto info = get_wl_surface_info(surface); - if (info->gamescope_swapchain != nullptr) + if (info->gamescope_swapchain != nullptr && info->last_refresh_cycle != refresh_cycle) { - // Could have got the override set in this bubble.s - surface = w->current_surface(); - - if (info->last_refresh_cycle != refresh_cycle) + wlserver_lock(); + if (info->gamescope_swapchain != nullptr) { - wlserver_lock(); - info->last_refresh_cycle = refresh_cycle; - wlserver_refresh_cycle(surface, refresh_cycle); - wlserver_unlock(); + // Could have got the override set in this bubble.s + surface = w->current_surface(); + + if (info->last_refresh_cycle != refresh_cycle) + { + info->last_refresh_cycle = refresh_cycle; + wlserver_refresh_cycle(surface, refresh_cycle); + } } + wlserver_unlock(); } } }