wayland-rs icon indicating copy to clipboard operation
wayland-rs copied to clipboard

client: Make object creation infallible

Open danieldg opened this issue 3 years ago • 2 comments

Calling methods that do not create objects on a Proxy will ignore InvalidId errors. This extends that functionality to creation methods.

This makes the solution to #530 much simpler (see https://github.com/danieldg/smithay-client-toolkit/commit/inert-proxies) because all failure cases can be handled prior to constructing the proxies.

danieldg avatar Jul 28 '22 02:07 danieldg

Codecov Report

Merging #531 (9c87708) into master (f19bab1) will decrease coverage by 0.08%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #531      +/-   ##
==========================================
- Coverage   76.74%   76.65%   -0.09%     
==========================================
  Files          50       50              
  Lines        6937     6936       -1     
==========================================
- Hits         5324     5317       -7     
- Misses       1613     1619       +6     
Flag Coverage Δ
main 62.42% <100.00%> (-0.01%) :arrow_down:
test-- 81.69% <100.00%> (+0.10%) :arrow_up:
test--server_system 63.63% <100.00%> (+0.06%) :arrow_up:
test-client_system- 71.35% <100.00%> (-0.22%) :arrow_down:
test-client_system-server_system 52.42% <100.00%> (-0.29%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
wayland-client/src/lib.rs 100.00% <ø> (ø)
wayland-scanner/src/client_gen.rs 99.18% <100.00%> (-0.01%) :arrow_down:
wayland-backend/src/sys/server_impl/mod.rs 75.33% <0.00%> (-0.90%) :arrow_down:
wayland-backend/src/sys/client_impl/mod.rs 75.03% <0.00%> (-0.15%) :arrow_down:
wayland-backend/src/rs/client_impl/mod.rs 78.98% <0.00%> (+0.18%) :arrow_up:
wayland-backend/src/rs/server_impl/handle.rs 71.18% <0.00%> (+0.34%) :arrow_up:
wayland-backend/src/rs/server_impl/client.rs 76.80% <0.00%> (+0.55%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Jul 28 '22 03:07 codecov[bot]

Just to make sure I understand, is this an alternative to #530 to meet SCTK's needs, or are both PRs needed?

It addresses part of what that PR addresses, and means that the FreezeHandle parts of that PR are not as needed in most situations. It's still possible to have a fast compositor and a fast other-app-thread conspire to flush, loop, and dispatch an event to a newly created object (XdgSurface, in popup) before Arc::new_cyclic increments the strong count, resulting in it looking like an event sent to a dead object - FreezeHandle would prevent this.

danieldg avatar Jul 28 '22 13:07 danieldg