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

backend/sys: associate imported proxy with correct event queue #750

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions wayland-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Bugfixes

- backend/sys: Fix importing external objects with `Backend::manage_object` by
associating the proxy with the correct event queue

## 0.3.6 -- 2024-07-16

### Bugfixes
Expand Down
10 changes: 9 additions & 1 deletion wayland-backend/src/sys/client_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,14 +757,22 @@ impl InnerBackend {
}

/// Start managing a Wayland object.
///
/// Safety: This will change the event queue the proxy is associated with.
/// Changing the event queue of an existing proxy is not thread-safe.
/// If another thread is concurrently reading the wayland socket and the
/// proxy already received an event it might get enqueued on the old event queue.
pub unsafe fn manage_object(
&self,
interface: &'static Interface,
proxy: *mut wl_proxy,
data: Arc<dyn ObjectData>,
) -> ObjectId {
let mut guard = self.lock_state();
unsafe { self.manage_object_internal(interface, proxy, data, &mut guard) }
unsafe {
ffi_dispatch!(wayland_client_handle(), wl_proxy_set_queue, proxy, guard.evq);
cmeissl marked this conversation as resolved.
Show resolved Hide resolved
self.manage_object_internal(interface, proxy, data, &mut guard)
}
}

/// Start managing a Wayland object.
Expand Down
Loading