wayland: guard event_flush commit against inactive session

The wl_event_loop_dispatch in event_flush could process a session
deactivation event (VT switch) while mid-animation, triggering a
wlroots assertion in wlr_backend_finish. Skip the commit and dispatch
when the DRM session is inactive.
This commit is contained in:
lkn 2026-06-26 07:11:07 +02:00
parent 01fb5f9e92
commit 46f0defabd
1 changed files with 3 additions and 5 deletions

View File

@ -3,6 +3,7 @@
#endif
#include <wayland-server-core.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/backend/session.h>
#include "../../screen.h"
#include "wl_types.h"
@ -11,12 +12,9 @@ void wl_event_flush(void)
{
wl_xdisplay_flush();
/* Commit the scene so intermediate animation frames are visible */
if (wl_state.scene_output && wl_state.allocator) {
if (wl_state.scene_output && wl_state.allocator &&
(!wl_state.session || wl_state.session->active)) {
wlr_scene_output_commit(wl_state.scene_output, NULL);
/* Flush the display so the frame reaches the DRM backend,
* then dispatch to process the page-flip completion event
* before returning. Without this, animation loops that
* call event_flush repeatedly only show the final frame. */
wl_display_flush_clients(wl_state.display);
struct wl_event_loop *loop = wl_display_get_event_loop(wl_state.display);
wl_event_loop_dispatch(loop, 0);