Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

wayland not call check_get_displays_changed_msg (#8637)

21pagesf07936a91196
diff --git a/libs/scrap/src/common/linux.rs b/libs/scrap/src/common/linux.rs
index e70ac6ca5..0f1e9b622 100644
--- a/libs/scrap/src/common/linux.rs
+++ b/libs/scrap/src/common/linux.rs
@@ -59,6 +59,7 @@ impl Display {
})
}
+ // Call this function carefully for wayland, it may cause blocking
pub fn all() -> io::Result<Vec<Display>> {
Ok(if super::is_x11() {
x11::Display::all()?
diff --git a/src/server/display_service.rs b/src/server/display_service.rs
index 0f54188a8..aa226099d 100644
--- a/src/server/display_service.rs
+++ b/src/server/display_service.rs
@@ -184,6 +184,14 @@ fn check_get_displays_changed_msg() -> Option<Message> {
}
pub fn check_displays_changed() -> ResultType<()> {
+ #[cfg(target_os = "linux")]
+ {
+ // For wayland, call Display::all() in video service will cause block, reproduced by refresh, I don't know the reason.
+ // block, or even crash here, https://github.com/rustdesk/rustdesk/blob/0bb4d43e9ea9d9dfb9c46c8d27d1a97cd0ad6bea/libs/scrap/src/wayland/pipewire.rs#L235
+ if !is_x11() {
+ return Ok(());
+ }
+ }
check_update_displays(&try_get_displays()?);
Ok(())
}
@@ -394,7 +402,8 @@ pub fn try_get_displays_(add_amyuni_headless: bool) -> ResultType<Vec<Display>>
let mut displays = Display::all()?;
// Do not add virtual display if the platform is not installed or the virtual display is not supported.
- if !crate::platform::is_installed() || !virtual_display_manager::is_virtual_display_supported() {
+ if !crate::platform::is_installed() || !virtual_display_manager::is_virtual_display_supported()
+ {
return Ok(displays);
}