Skip to content

Commit

Permalink
backend: Fix test of alive when sending object argument
Browse files Browse the repository at this point in the history
Fixes #665.
  • Loading branch information
ids1024 committed Jan 13, 2024
1 parent 1faabd9 commit 7a24139
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions wayland-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Additions
- client: Implement `Eq` for `Backend`

#### Bugfixes
- backend/sys: Fix error/segfault if object argument is no longer alive

## 0.3.2 -- 2023-09-25

#### Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion wayland-backend/src/sys/client_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ impl InnerBackend {
Argument::Object(ref o) => {
let next_interface = arg_interfaces.next().unwrap();
if !o.id.ptr.is_null() {
if !id.alive.as_ref().map(|a| a.load(Ordering::Acquire)).unwrap_or(true) {
if !o.id.alive.as_ref().map(|a| a.load(Ordering::Acquire)).unwrap_or(true) {
unsafe { free_arrays(message_desc.signature, &argument_list) };
return Err(InvalidId);
}
Expand Down
2 changes: 1 addition & 1 deletion wayland-backend/src/sys/server_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ impl<D: 'static> ErasedState for State<D> {
Argument::Object(ref o) => {
let next_interface = arg_interfaces.next().unwrap();
if !o.id.ptr.is_null() {
if !id.alive.load(Ordering::Acquire) {
if !o.id.alive.load(Ordering::Acquire) {
unsafe { free_arrays(message_desc.signature, &argument_list) };
return Err(InvalidId);
}
Expand Down

0 comments on commit 7a24139

Please sign in to comment.