diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index acfad1b3..dbf80b15 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1311,6 +1311,10 @@ struct weston_compositor { struct weston_log_scope *libseat_debug; struct content_protection *content_protection; + + /* One-time warning about a view appearing in the layer list when it + * or its surface are not mapped. */ + bool warned_about_unmapped_surface_or_view; }; struct weston_buffer { diff --git a/libweston/compositor.c b/libweston/compositor.c index 47226f73..bd1ad5e8 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2991,6 +2991,26 @@ view_list_add(struct weston_compositor *compositor, struct weston_subsurface *sub; weston_view_update_transform(view); + + /* It is possible for a view to appear in the layer list even though + * the view or the surface is unmapped. This is erroneous but difficult + * to fix. */ + if (!weston_surface_is_mapped(view->surface) || + !weston_view_is_mapped(view) || + !weston_surface_has_content(view->surface)) { + if (!compositor->warned_about_unmapped_surface_or_view) { + weston_log("Detected an unmapped surface or view in " + "the layer list, which should not occur.\n"); + compositor->warned_about_unmapped_surface_or_view = true; + } + + pnode = weston_view_find_paint_node(view, output); + if (pnode) + weston_paint_node_destroy(pnode); + + return; + } + pnode = view_ensure_paint_node(view, output); if (wl_list_empty(&view->surface->subsurface_list)) {