From 90b945b780014ffd47124c9d2c1aa9fe40cf5245 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sat, 19 Jul 2025 00:38:48 +0200 Subject: [PATCH] wait-for-sync-obj: clear tasks on shutdown --- src/state.rs | 1 + src/video/drm/wait_for_sync_obj.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/state.rs b/src/state.rs index 66035332..1ea2ac4a 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1073,6 +1073,7 @@ impl State { self.cursor_user_groups.clear(); self.cursor_user_group_hardware_cursor.take(); self.cpu_worker.clear(); + self.wait_for_sync_obj.clear(); } pub fn remove_toplevel_id(&self, id: ToplevelIdentifier) { diff --git a/src/video/drm/wait_for_sync_obj.rs b/src/video/drm/wait_for_sync_obj.rs index 58be19e5..3ce0a57c 100644 --- a/src/video/drm/wait_for_sync_obj.rs +++ b/src/video/drm/wait_for_sync_obj.rs @@ -87,6 +87,12 @@ impl WaitForSyncObj { } } + pub fn clear(&self) { + self.inner.ctx.take(); + self.inner.busy.clear(); + self.inner.idle.take(); + } + pub fn set_ctx(&self, ctx: Option>) { self.inner.ctx.set(ctx); let busy_waiters: Vec<_> = self.inner.busy.lock().drain_values().collect(); @@ -163,13 +169,6 @@ impl WaitForSyncObj { } } -impl Drop for WaitForSyncObj { - fn drop(&mut self) { - self.inner.busy.clear(); - self.inner.idle.take(); - } -} - impl WaiterInner { async fn run(self: Rc) { let mut buf = Buf::new(8);