ivi-shell: unmap views which are not in scenegraph

From Michael Olbrich:
"Both the core in weston_compositor_build_view_list() with view.link
and the ivi-shell in commit_screen_list() with view.layer_link
don't remove the old views from the list.

As a result, all views that are not currently in the list have
old broken links. Destroying such a view tries to remove
the view from these lists and will access the old, invalid pointers."

Therefore, we have to unmap weston_views which are not in current
scenegraph of ivi-shell. I implemented ivi_view_is_mapped() function
to check mappedness of ivi_views. The functions checks:
   - the view is on a layer's order list
   - the layer is on a screen
   - the layer and view's ivi_surface are visible

If ivi_view is not mapped but weston_view is still mapped,
we have to unmap the weston_view with weston_view_unmap() call.

Reported-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
dev
Emre Ucan 6 years ago
parent e1e7ebdbea
commit f6638a7f0f
  1. 17
      ivi-shell/ivi-layout.c

@ -586,6 +586,15 @@ update_prop(struct ivi_layout_view *ivi_view)
weston_view_schedule_repaint(ivi_view->view); weston_view_schedule_repaint(ivi_view->view);
} }
static bool
ivi_view_is_mapped(struct ivi_layout_view *ivi_view)
{
return (!wl_list_empty(&ivi_view->order_link) &&
ivi_view->on_layer->on_screen &&
ivi_view->on_layer->prop.visibility &&
ivi_view->ivisurf->prop.visibility);
}
static void static void
commit_changes(struct ivi_layout *layout) commit_changes(struct ivi_layout *layout)
{ {
@ -816,6 +825,14 @@ build_view_list(struct ivi_layout *layout)
struct ivi_layout_layer *ivilayer; struct ivi_layout_layer *ivilayer;
struct ivi_layout_view *ivi_view; struct ivi_layout_view *ivi_view;
/* If ivi_view is not part of the scenegrapgh, we have to unmap
* weston_views
*/
wl_list_for_each(ivi_view, &layout->view_list, link) {
if (!ivi_view_is_mapped(ivi_view))
weston_view_unmap(ivi_view->view);
}
/* Clear view list of layout ivi_layer */ /* Clear view list of layout ivi_layer */
wl_list_init(&layout->layout_layer.view_list.link); wl_list_init(&layout->layout_layer.view_list.link);

Loading…
Cancel
Save