From f5a7ab0167d66d377bb53131b60f9cf7cc2d4bac Mon Sep 17 00:00:00 2001 From: Jente Hidskes Date: Sun, 18 Oct 2020 23:01:58 +0200 Subject: [PATCH] desktop/view: fix segfault in damage_surface_iterator This function can get called on a surface that is not actually a view. We need the view for the output, but we can pass that as user_data instead when the iterator gets called for all surfaces in a view. --- desktop/view.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/view.c b/desktop/view.c index b580e4c..788ff4f 100644 --- a/desktop/view.c +++ b/desktop/view.c @@ -68,8 +68,8 @@ cage_view_position(struct cg_view *view) static void damage_surface_iterator(struct wlr_surface *surface, int sx, int sy, void *user_data) { - struct cg_view *view = (struct cg_view *) surface->data; - cage_output_damage_surface(view->output, surface, sx, sy); + struct cg_output *output = (struct cg_output *) user_data; + cage_output_damage_surface(output, surface, sx, sy); } void @@ -109,7 +109,7 @@ void cage_view_damage_part(struct cg_view *view) { assert(view != NULL); - cage_view_for_each_surface(view, damage_surface_iterator, NULL); + cage_view_for_each_surface(view, damage_surface_iterator, (void *) view->output); } struct wlr_surface *