From d91d5d674c5b456d25f2e865b28d99aa57f4db4f Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 9 Oct 2023 17:37:15 +0400 Subject: Set redraw state to idle on early returns Haven't hit any problems due to this yet, but I suspect that it's possible. --- src/niri.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/niri.rs b/src/niri.rs index a276b643..328f4aae 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1236,20 +1236,22 @@ impl Niri { fn redraw(&mut self, backend: &mut Backend, output: &Output) { let _span = tracy_client::span!("Niri::redraw"); + let state = self.output_state.get_mut(output).unwrap(); + assert!(matches!( + state.redraw_state, + RedrawState::Queued(_) | RedrawState::WaitingForEstimatedVBlankAndQueued(_) + )); + if !backend.is_active() { + state.redraw_state = RedrawState::Idle; return; } let Some(renderer) = backend.renderer() else { + state.redraw_state = RedrawState::Idle; return; }; - let state = self.output_state.get_mut(output).unwrap(); - assert!(matches!( - state.redraw_state, - RedrawState::Queued(_) | RedrawState::WaitingForEstimatedVBlankAndQueued(_) - )); - let presentation_time = state.frame_clock.next_presentation_time(); // Update from the config and advance the animations. -- cgit