Skip to content

Commit

Permalink
Fixed a segfault in lbdbus
Browse files Browse the repository at this point in the history
modified:   Cargo.toml
modified:   src/linux/wayland_capture.rs
  • Loading branch information
FractalFir committed Oct 7, 2024
1 parent 99af18b commit 05186b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ windows = { version = "0.58", features = [
[target.'cfg(target_os="linux")'.dependencies]
percent-encoding = "2.3"
xcb = { version = "1.4", features = ["randr"] }
dbus = { version = "0.9", features = ["vendored"] }
dbus = { version = "0.9.7" }

[dev-dependencies]
fs_extra = "1.3"
5 changes: 2 additions & 3 deletions src/linux/wayland_capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ pub fn wayland_capture(impl_monitor: &ImplMonitor) -> XCapResult<RgbaImage> {
let y = ((impl_monitor.y as f32) * impl_monitor.scale_factor) as i32;
let width = ((impl_monitor.width as f32) * impl_monitor.scale_factor) as i32;
let height = ((impl_monitor.height as f32) * impl_monitor.scale_factor) as i32;

let conn = Connection::new_session()?;
let lock = DBUS_LOCK.lock();
let conn = Connection::new_session()?;
let res = org_gnome_shell_screenshot(&conn, x, y, width, height)
.or_else(|_| org_freedesktop_portal_screenshot(&conn, x, y, width, height));
drop(lock);
Expand All @@ -189,7 +188,7 @@ fn screnshot_multithreaded() {
}
}
// Try making screenshots in paralel. If this times out, then this means that there is a threading issue.
const PARALELISM: usize = 1;
const PARALELISM: usize = 10;
let handles: Vec<_> = (0..PARALELISM)
.map(|_| {
std::thread::spawn(|| {
Expand Down

0 comments on commit 05186b1

Please sign in to comment.