desktop: Allow to remove surface from pending list 57/25557/4
authorWalter Lozano <walter.lozano@collabora.com>
Fri, 13 Nov 2020 14:46:08 +0000 (14:46 +0000)
committerWalter Lozano <walter.lozano@collabora.com>
Tue, 17 Nov 2020 16:43:16 +0000 (16:43 +0000)
In some special corner cases a surface can be removed while it is
still in the pending list. An example of this case is when a surface
is added and removed before the system is ready. Under this circumstances
the surface still has role == ROLE_NONE and is in the pending list.

The fact of not removing the surface from the pending_list ends in a
segfault when the system is ready.

In order to fix the issue, remove the restriction to only remove surfaces
with role != ROLE_NONE.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
Change-Id: Ia71b6c3ca214849448c935cc09039581d0e209a8

src/desktop.c

index f7d11b1..7127c2d 100644 (file)
@@ -96,6 +96,7 @@ desktop_surface_added(struct weston_desktop_surface *dsurface, void *userdata)
        surface->activated_by_default = false;
        surface->advertised_on_launch = false;
        surface->checked_pending = false;
+       wl_list_init(&surface->link);
 
        wl_signal_init(&surface->signal_advertise_app);
 
@@ -238,9 +239,7 @@ skip_output_asignment:
                        weston_desktop_surface_get_app_id(dsurface),
                        ivi_layout_get_surface_role_name(surface));
 
-       /* we weren't added to any list if we are still with 'none' as role */
-       if (surface->role != IVI_SURFACE_ROLE_NONE)
-               wl_list_remove(&surface->link);
+       wl_list_remove(&surface->link);
 
        free(surface);
 }