Skip to content

Commit

Permalink
backend/sys: associate imported proxy with correct event queue
Browse files Browse the repository at this point in the history
fixes a regression introduced in e777e85
which moved all proxies to a separate event queue but left proxies imported
with `Backend::manage_object` on the default queue.
  • Loading branch information
cmeissl authored and ids1024 committed Sep 3, 2024
1 parent fb5bd40 commit e648903
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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);
self.manage_object_internal(interface, proxy, data, &mut guard)
}
}

/// Start managing a Wayland object.
Expand Down

0 comments on commit e648903

Please sign in to comment.