Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metal: prevent infinite loop in hardware-cursor update #232

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/tasks/hardware_cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub async fn handle_hardware_cursor_tick(state: Rc<State>) {
log::error!("Could not wait for cursor tick: {}", ErrorFmt(e));
break;
}
} else {
if state.hardware_tick_cursor.is_not_empty() {
break;
}
}
state.refresh_hardware_cursors();
}
Expand Down
8 changes: 8 additions & 0 deletions src/utils/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ impl<T> AsyncQueue<T> {
AsyncQueueNonEmpty { queue: self }
}

pub fn is_empty(&self) -> bool {
unsafe { self.data.get().deref().is_empty() }
}

pub fn is_not_empty(&self) -> bool {
!self.is_empty()
}

pub fn clear(&self) {
unsafe {
mem::take(self.data.get().deref_mut());
Expand Down
Loading