diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-04-29 09:03:15 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-04-29 09:17:19 +0200 |
commit | ef5f3233f9c01303eb00716acbcc3d577b699809 (patch) | |
tree | 1c29463e85d3c3854ada518b5cc23d2bb3183ae4 | |
parent | bac1a7a71f5d49451ad5c6655ef4e79334ba9c38 (diff) |
compositor: fix endless recursion in scene-graph printing
If a surface has subsurfaces then the surface itself is in the subsurface
list. To avoid printing it again there is a check to skip the child view,
if it is the same as the current view.
However, this fails when a surface with subsurfaces has two (or more) views:
The check to skip the parent fails for the other view and the two views are
printed again and again until a stack overflow occurs.
So instead check if the parent view of the subsurface view is the current
view. This way, any view that does not belong to a real subsurface is
skipped.
As a side effect, this ensures that each view of the subsurfaces is only
printed once at the correct place in the hierarchy.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | libweston/compositor.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c index 35da1e65..5fda9432 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -7162,8 +7162,8 @@ debug_scene_view_print_tree(struct weston_view *view, wl_list_for_each(sub, &view->surface->subsurface_list, parent_link) { wl_list_for_each(ev, &sub->surface->views, surface_link) { - /* do not print again the parent view */ - if (view == ev) + /* only print the child views of the current view */ + if (ev->parent_view != view) continue; (*view_idx)++; |