shell: Add some extra checks to make sure we don't trip ourselves 70/24670/1
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 5 Jun 2020 12:27:31 +0000 (15:27 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Mon, 8 Jun 2020 20:23:35 +0000 (23:23 +0300)
Dynamically removing and inserting surfaces on outputs requires making
sure the surface is still mapped on that output.

Bug-AGL: SPEC-3280

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4cb94d12cd1e7d907962faaf40e3d295cdfa9245

src/shell.c

index 6944f8a..3f522ba 100644 (file)
@@ -559,8 +559,16 @@ create_black_surface_view(struct ivi_output *output)
 void
 remove_black_surface(struct ivi_output *output)
 {
-       struct weston_view *view = output->fullscreen_view.fs->view;
+       struct weston_view *view;
 
+       if (!output &&
+           !output->fullscreen_view.fs &&
+           !output->fullscreen_view.fs->view) {
+               weston_log("Output %s doesn't have a surface installed!\n", output->name);
+               return;
+       }
+
+       view = output->fullscreen_view.fs->view;
        assert(view->is_mapped == true ||
               view->surface->is_mapped == true);
 
@@ -576,8 +584,16 @@ remove_black_surface(struct ivi_output *output)
 void
 insert_black_surface(struct ivi_output *output)
 {
-       struct weston_view *view = output->fullscreen_view.fs->view;
+       struct weston_view *view;
 
+       if (!output &&
+           !output->fullscreen_view.fs &&
+           !output->fullscreen_view.fs->view) {
+               weston_log("Output %s doesn't have a surface installed!\n", output->name);
+               return;
+       }
+
+       view = output->fullscreen_view.fs->view;
        if (view->is_mapped || view->surface->is_mapped)
                return;