mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-06-29 12:25:02 +03:00
fix(wayland): clipboard, support ext-data-control (#15366)
* fix(wayland): clipboard, support ext-data-control Signed-off-by: fufesou <linlong1266@gmail.com> * fix(clipboard): restart stale listener and log join panics Signed-off-by: fufesou <linlong1266@gmail.com> * update clipboard-master Signed-off-by: fufesou <linlong1266@gmail.com> * refactor(clipboard): remove redundant stale listener cleanup Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -868,6 +868,7 @@ pub mod clipboard_listener {
|
||||
.unwrap()
|
||||
.insert(name.clone(), tx);
|
||||
|
||||
cleanup_stale_listener(&mut listener_lock);
|
||||
if listener_lock.handle.is_none() {
|
||||
log::info!("Start clipboard listener thread");
|
||||
let handler = Handler {
|
||||
@@ -893,6 +894,24 @@ pub mod clipboard_listener {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn cleanup_stale_listener(listener: &mut ClipboardListener) {
|
||||
if !listener
|
||||
.handle
|
||||
.as_ref()
|
||||
.map(|(_, h)| h.is_finished())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if let Some((shutdown, h)) = listener.handle.take() {
|
||||
log::warn!("Cleaning up stale clipboard listener handle");
|
||||
if let Err(e) = h.join() {
|
||||
log::error!("Clipboard listener thread panicked during stale cleanup: {:?}", e);
|
||||
}
|
||||
drop(shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unsubscribe(name: &str) {
|
||||
log::info!("Unsubscribe clipboard listener: {}", name);
|
||||
let mut listener_lock = CLIPBOARD_LISTENER.lock().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user