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

Wayland : Fix multithreading bug + fix segfault in libdubs on certain systems. #156

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

FractalFir
Copy link
Contributor

This PR fixes two issues I had encountered with xcap.

  1. Due to a bug in xcap, taking more than one screenshoot at a time would cause XCapError("Screenshot failed or canceled").

This was caused by dbus messages getting lost when multiple threads interacted with dbus.

This seems like a multi-threading bug, probably caused either by improper dbus usage.

This PR fixes this issue, by ensuring no more than 2 threads can take a screenshot at any given time, using a Mutex.

I have also included a test, which demonstrates the original bug, and allows for checking if it has returned.

  1. Segfaults in libdbus.

For unclear reasons(I am still trying to figure them out with the maintainer of thedbus crate), using the vendored feature of dbus causes crashes(segfaults) on certain systems.

As a workaround, this PR turns the vendored feature off, to allow xcap to work reliably on all systems.

…enshots to fail when two threads tried to take them at once.
modified:   Cargo.toml
modified:   src/linux/wayland_capture.rs
@nashaofu nashaofu merged commit 7e00ec5 into nashaofu:master Oct 8, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants