shell: Provide a better explanation for terminating the connection 48/29548/1
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 19 Dec 2023 14:24:05 +0000 (16:24 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 20 Dec 2023 17:05:44 +0000 (19:05 +0200)
And make sure we clear off the remaing client resources when doing an
unbind.

It seems we would hit it when checking set_background/ready/set_panel
requests, resulting in a protocol violation and finally terminating the
connection.

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

src/shell.c

index 5157830..c089bec 100644 (file)
@@ -1108,8 +1108,8 @@ shell_ready(struct wl_client *client, struct wl_resource *shell_res)
            ivi->shell_client.status == BOUND_FAILED) {
                wl_resource_post_error(shell_res,
                                       WL_DISPLAY_ERROR_INVALID_OBJECT,
-                                      "agl_shell has already been bound. "
-                                      "Check out bound_fail event");
+                                      "agl_shell (ready quest) has already "
+                                      "been bound. Check out bound_fail event");
                return;
        }
 
@@ -1165,8 +1165,8 @@ shell_set_background(struct wl_client *client,
            ivi->shell_client.resource_ext == shell_res) {
                wl_resource_post_error(shell_res,
                                       WL_DISPLAY_ERROR_INVALID_OBJECT,
-                                      "agl_shell has already been bound. "
-                                      "Check out bound_fail event");
+                                      "agl_shell (set_background) has already "
+                                      "been bound. Check out bound_fail event");
                return;
        }
 
@@ -1230,7 +1230,7 @@ shell_set_panel(struct wl_client *client,
            ivi->shell_client.resource_ext == shell_res) {
                wl_resource_post_error(shell_res,
                                       WL_DISPLAY_ERROR_INVALID_OBJECT,
-                                      "agl_shell has already been bound. "
+                                      "agl_shell (set_panel) has already been bound. "
                                       "Check out bound_fail event");
                return;
        }
@@ -1860,6 +1860,7 @@ unbind_agl_shell(struct wl_resource *resource)
 
        ivi->shell_client.ready = false;
        ivi->shell_client.resource = NULL;
+       ivi->shell_client.resource_ext = NULL;
        ivi->shell_client.client = NULL;
 }
 
@@ -1869,6 +1870,7 @@ unbind_agl_shell_ext(struct wl_resource *resource)
        struct ivi_compositor *ivi = wl_resource_get_user_data(resource);
 
        ivi->shell_client_ext.resource = NULL;
+       ivi->shell_client.resource_ext = NULL;
 }
 
 static void