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

update_from_render_element_states relies on strong_count to determine if Output is still valid #1584

Open
ids1024 opened this issue Nov 13, 2024 · 0 comments

Comments

@ids1024
Copy link
Member

ids1024 commented Nov 13, 2024

let has_valid_output = primary_scanout_output
.as_ref()
.map(|(current, _)| current.is_alive())
.unwrap_or(false);

WeakOutput::is_alive() simply checks if the strong count is 0. In cosmic-comp I seem to be seeing an issue with it. Perhaps a strong reference is being held somewhere it shouldn't, either in Smithay or cosmic-comp.

Careful use of WeakOutput should avoid that, but I wonder if it would also be a good idea to explicitly track if the output is valid, instead of relying on reference count.

A compositor can set a compare callback that has an additional check to see if the old Output is still valid. But default_primary_scanout_output_compare won't do that. So this may be causing issues for any Smithay compositors that don't have a custom callback with some check for old removed/disabled outputs.

ids1024 added a commit to pop-os/cosmic-comp that referenced this issue Nov 13, 2024
`Output` in Smithay doesn't track if the output still exists, other than
based on whether or not it has strong references. Which doesn't seem to
be working correctly.

There may be leaked strong references to `Output`s somewhere, and maybe
Smithay should track if an output is still valid, generally when it is
exposed as a Wayland global
(Smithay/smithay#1584). But a check like this
works for now.

Addresses #985.
Drakulix pushed a commit to pop-os/cosmic-comp that referenced this issue Nov 13, 2024
`Output` in Smithay doesn't track if the output still exists, other than
based on whether or not it has strong references. Which doesn't seem to
be working correctly.

There may be leaked strong references to `Output`s somewhere, and maybe
Smithay should track if an output is still valid, generally when it is
exposed as a Wayland global
(Smithay/smithay#1584). But a check like this
works for now.

Addresses #985.
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 a pull request may close this issue.

1 participant