libweston: Skip views without a parent

This prevents to trigger an assert within
weston_view_set_rel_position(), introduced with commit 'libweston: Split
weston_view_set_position() into rel and abs variants', which is hit when
a subsurface attempts to commit without having a parent surface set.

Fixes: #730

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Colin Kinloch <collin.kinloch@collabora.com>
This commit is contained in:
Marius Vlad 2023-03-17 11:07:49 +02:00 committed by Daniel Stone
parent 1ed88f60c0
commit 1e867c189f
2 changed files with 8 additions and 0 deletions

View file

@ -1563,6 +1563,7 @@ struct weston_view {
uint32_t psf_flags;
bool is_mapped;
struct weston_log_pacer subsurface_parent_log_pacer;
};
struct weston_surface_state {

View file

@ -4543,6 +4543,13 @@ subsurface_committed(struct weston_surface *surface,
wl_list_for_each(view, &surface->views, surface_link) {
struct weston_coord_surface tmp = new_origin;
if (!view->geometry.parent) {
weston_log_paced(&view->subsurface_parent_log_pacer,
1, 0, "Client attempted to commit on a "
"subsurface without a parent surface\n");
continue;
}
tmp.c = weston_coord_add(tmp.c,
view->geometry.pos_offset);
weston_view_set_rel_position(view, tmp.c.x, tmp.c.y);