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);