desktop: Do not attempt to send terminate event 15/28015/1
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 21 Sep 2022 16:44:52 +0000 (19:44 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 22 Sep 2022 11:01:36 +0000 (14:01 +0300)
For cases where the shell client itself is stopped/terminated
or the compositor is taken down, and implicitly with it, the shell
client we won't really have a reasource available.  Use the shell_ready
flag to verify that.

Fixes: 0512e7251611e7040c55

Bug-AGL: SPEC-4528
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I78b4fb39a76402535e642dda9cf284b57856376d

src/desktop.c

index f28d0c9..0e71de9 100644 (file)
@@ -370,7 +370,9 @@ skip_output_asignment:
                shell_advertise_app_state(output->ivi, app_id,
                                          NULL, AGL_SHELL_DESKTOP_APP_STATE_DESTROYED);
 
-               if (wl_resource_get_version(output->ivi->shell_client.resource) >= AGL_SHELL_APP_STATE_SINCE_VERSION)
+               if (output->ivi->shell_client.ready &&
+                   wl_resource_get_version(output->ivi->shell_client.resource)
+                   >= AGL_SHELL_APP_STATE_SINCE_VERSION)
                        agl_shell_send_app_state(output->ivi->shell_client.resource,
                                                 app_id, AGL_SHELL_APP_STATE_TERMINATED);
        }