Commit a27658e9 authored by Marius Vlad's avatar Marius Vlad

desktop-shell: Do not try to add a child to a non-existent parent

Introduced with a8da2084, it seems that there are cases when there's no
parent available (zenity, for instance).

Removes any potential child and re-initialize it, in case the parent is
not set. (Simon Ser)

Fixes: #340
Signed-off-by: Marius Vlad's avatarMarius Vlad <>
Reviewed-by: Simon Ser's avatarSimon Ser <>
Reported-by: n3rdopolis's avatarn3rdopolis <>
parent c3c0b247
Pipeline #98387 passed with stages
in 1 minute and 22 seconds
...@@ -2769,13 +2769,20 @@ desktop_surface_set_parent(struct weston_desktop_surface *desktop_surface, ...@@ -2769,13 +2769,20 @@ desktop_surface_set_parent(struct weston_desktop_surface *desktop_surface,
struct weston_desktop_surface *parent, struct weston_desktop_surface *parent,
void *shell) void *shell)
{ {
struct shell_surface *shsurf_parent;
struct shell_surface *shsurf = struct shell_surface *shsurf =
weston_desktop_surface_get_user_data(desktop_surface); weston_desktop_surface_get_user_data(desktop_surface);
struct shell_surface *shsurf_parent =
/* unlink any potential child */
if (parent) {
shsurf_parent = weston_desktop_surface_get_user_data(parent);
wl_list_insert(shsurf_parent->children_list.prev, wl_list_insert(shsurf_parent->children_list.prev,
&shsurf->children_link); &shsurf->children_link);
} else {
} }
static void static void
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment