smithay icon indicating copy to clipboard operation
smithay copied to clipboard

`update_from_render_element_states` relies on `strong_count` to determine if `Output` is still valid

Open ids1024 opened this issue 1 year ago • 0 comments

https://github.com/Smithay/smithay/blob/28417d22202a10e24de53b8994f5044aa042dcc5/src/backend/renderer/element/mod.rs#L194-L197

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 avatar Nov 13 '24 21:11 ids1024