wayland-client : do not abort when there is an EBADF error on marshalling request
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 10 Mar 2021 10:28:46 +0000 (19:28 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 16 Feb 2023 10:12:22 +0000 (19:12 +0900)
wayland-tbm create wl_buffer with fd but it is sometimes failed  because
fd duplication is failed with EBADF error.
we guess another thread close fd of wayland-tbm.
wayland-tbm retry to create wl_buffer with key when it is failed with fd
but process is aborted in wayland-client.
so this patch allows wayland-tbm create wl_buffer proxy with key
when fd duplication is failed in wayland-client.

Change-Id: Id56e0ff87784678a5a192a0bc6f0aabae39da5df

src/connection.c
src/wayland-client.c

index 6e62948..8ae5767 100644 (file)
@@ -813,6 +813,9 @@ wl_closure_marshal(struct wl_object *sender, uint32_t opcode,
                        break;
                case 'h':
                        fd = args[i].h;
+                       // TIZEN_ONLY(20210310) : wayland-client : do not abort when there is an EBADF error on marshalling request
+                       errno = 0;
+                       // TIZEN_ONLY : END
                        dup_fd = wl_os_dupfd_cloexec(fd, 0);
                        if (dup_fd < 0) {
                                wl_closure_destroy(closure);
index e58f189..4304e9f 100644 (file)
@@ -1012,6 +1012,16 @@ wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
 
        closure = wl_closure_marshal(&proxy->object, opcode, args, message);
        if (closure == NULL) {
+               // TIZEN_ONLY(20210310) : wayland-client : do not abort when there is an EBADF error on marshalling request
+               if (errno == EBADF) {
+                       wl_log("fail wl_closure_marshal with EBADF");
+                       new_proxy->flags |= WL_PROXY_FLAG_ID_DELETED;
+                       proxy_destroy(new_proxy);
+                       new_proxy = NULL;
+                       goto err_unlock;
+               }
+               // TIZEN_ONLY : END
+
                // TIZEN_ONLY(20200306) : wayland-client : do abort when there is an error on marshalling request
                wl_abort("Error marshalling request: %m\n");
                // TIZEN_ONLY : END
@@ -3169,4 +3179,4 @@ wl_display_get_name(struct wl_display *display)
 
        return display->name;
 }
-// END
\ No newline at end of file
+// END