diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 7c8d2eeaf..94880c82c 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -6670,6 +6670,8 @@ void handle_done_commits_xdg() void handle_presented_for_window( steamcompmgr_win_t* w ) { + // wlserver_lock is held. + uint64_t next_refresh_time = g_SteamCompMgrVBlankTime.schedule.ulTargetVBlank; uint64_t refresh_cycle = g_nSteamCompMgrTargetFPS && steamcompmgr_window_should_limit_fps( w ) @@ -6681,8 +6683,6 @@ void handle_presented_for_window( steamcompmgr_win_t* w ) { if (!lastCommit->presentation_feedbacks.empty() || lastCommit->present_id) { - wlserver_lock(); - if (!lastCommit->presentation_feedbacks.empty()) { wlserver_presentation_feedback_presented( @@ -6703,17 +6703,14 @@ void handle_presented_for_window( steamcompmgr_win_t* w ) lastCommit->present_margin); lastCommit->present_id = std::nullopt; } - - wlserver_unlock(); } } if (struct wlr_surface *surface = w->current_surface()) { auto info = get_wl_surface_info(surface); - if (info->gamescope_swapchain != nullptr && info->last_refresh_cycle != refresh_cycle) + if (info != nullptr && info->gamescope_swapchain != nullptr && info->last_refresh_cycle != refresh_cycle) { - wlserver_lock(); if (info->gamescope_swapchain != nullptr) { // Could have got the override set in this bubble.s @@ -6725,7 +6722,6 @@ void handle_presented_for_window( steamcompmgr_win_t* w ) wlserver_refresh_cycle(surface, refresh_cycle); } } - wlserver_unlock(); } } } @@ -8147,9 +8143,11 @@ steamcompmgr_main(int argc, char **argv) if ( vblank ) { + wlserver_lock(); gamescope_xwayland_server_t *server = NULL; for (size_t i = 0; (server = wlserver_get_xwayland_server(i)); i++) handle_presented_xwayland( server->ctx.get() ); + wlserver_unlock(); } //