1
0
Fork 0
forked from wry/wry

Merge pull request #232 from mahkoh/jorth/fix-hc-tick

metal: prevent infinite loop in hardware-cursor update
This commit is contained in:
mahkoh 2024-07-23 22:50:38 +02:00 committed by GitHub
commit 6d769a15b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -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();
}

View file

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