desktop: Avoid referencing the output's surface for pending surfaces 33/24833/1
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 24 Jun 2020 13:01:36 +0000 (16:01 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 24 Jun 2020 14:31:25 +0000 (17:31 +0300)
Pending surfaces will only get a valid role when the client shell sends
out ready() request to start presenting. Corner-case would be that
pending surface is destroyed, moment in which we realise we never set-up
an output. This is corner-case and treat as is.

Bug-AGL: SPEC-3448

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

src/desktop.c

index 00cc4db..479174d 100644 (file)
@@ -137,6 +137,12 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
                weston_desktop_surface_get_surface(dsurface);
 
        struct ivi_output *output = ivi_layout_get_output_from_surface(surface);
+
+       /* special corner-case, pending_surfaces which are never activated or
+        * being assigned an output might land here so just remove the surface */
+       if (output == NULL && surface->role == IVI_SURFACE_ROLE_NONE)
+               goto skip_output_asignment;
+
        assert(output != NULL);
 
        /* resize the active surface to the original size */
@@ -199,6 +205,7 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
                output->background = NULL;
        }
 
+skip_output_asignment:
        weston_log("Removed surface %p, app_id %s, role %s\n", surface,
                        weston_desktop_surface_get_app_id(dsurface),
                        ivi_layout_get_surface_role_name(surface));