subsurface_widget: Clear subsurface list after calls to ::draw()

Otherwise the `draw` call in response to `AboutToWait` causes this list
to grow, and eventually hit errors in `sendmsg` due to too many buffered
file descriptors from creating subsurfaces.

Probably the number of places `UserInterface::draw` are called should be
cleaned up. And it shouldn't be called in `AboutToWiat` like this. Some
improvements could probably be made in upstream iced.
This commit is contained in:
Ian Douglas Scott 2024-11-06 15:41:22 -08:00 committed by Ashley Wulber
parent c18f5f6dda
commit dd9576d94e
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 12 additions and 0 deletions

View file

@ -1133,6 +1133,7 @@ async fn run_instance<P>(
},
cursor,
);
platform_specific_handler.clear_subsurface_list();
draw_span.finish();
if let user_interface::State::Updated {

View file

@ -72,6 +72,13 @@ impl PlatformSpecific {
}
}
pub(crate) fn clear_subsurface_list(&mut self) {
#[cfg(all(feature = "wayland", target_os = "linux"))]
{
self.wayland.clear_subsurface_list();
}
}
pub(crate) fn update_subsurfaces(
&mut self,
id: window::Id,

View file

@ -181,6 +181,10 @@ impl WaylandSpecific {
};
}
pub(crate) fn clear_subsurface_list(&mut self) {
let _ = crate::subsurface_widget::take_subsurfaces();
}
pub(crate) fn update_subsurfaces(
&mut self,
id: window::Id,