main: Create black surface after listening socket 04/25404/2
authorWalter Lozano <walter.lozano@collabora.com>
Thu, 8 Oct 2020 02:19:45 +0000 (02:19 +0000)
committerWalter Lozano <walter.lozano@collabora.com>
Thu, 8 Oct 2020 13:14:38 +0000 (10:14 -0300)
If agl-compositor is started without XDG_RUNTIME_DIR defined, an error
arises and the system tries to exit cleanly. However, in this process a
segfault is produced and the terminal is left misconfigured.

The cause of this segfault is related to the destruction of the black
surface, which is not handled properly in this corner case.

In order to avoid this issue and as an initial fix, create the surface
after the listening socket, which causes that the check for the var
XDG_RUNTIME_DIR to be done before the surface creation.

Bug-AGL: SPEC-3623

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

src/main.c

index 590977f..2cefcd6 100644 (file)
@@ -1489,11 +1489,11 @@ int main(int argc, char *argv[])
        if (ivi.remoting_api)
                ivi_enable_remote_outputs(&ivi);
 
-       ivi_shell_init_black_fs(&ivi);
-
        if (create_listening_socket(display, socket_name) < 0)
                goto error_compositor;
 
+       ivi_shell_init_black_fs(&ivi);
+
        ivi.compositor->exit = handle_exit;
 
        weston_compositor_wake(ivi.compositor);