aboutsummaryrefslogtreecommitdiffstats
path: root/src/connection.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2013-03-08 18:44:16 +0100
committerKristian Høgsberg <krh@bitplanet.net>2013-03-17 16:39:48 -0400
commitcb73bffed53128ed4f7a943e37c718b724199461 (patch)
tree74047360c9e2c9925fe5629cff835608fa3fc5c2 /src/connection.c
parentclient: Check reference count only for destroyed proxies (diff)
downloadwayland-cb73bffed53128ed4f7a943e37c718b724199461.tar
wayland-cb73bffed53128ed4f7a943e37c718b724199461.tar.gz
wayland-cb73bffed53128ed4f7a943e37c718b724199461.tar.bz2
wayland-cb73bffed53128ed4f7a943e37c718b724199461.tar.lz
wayland-cb73bffed53128ed4f7a943e37c718b724199461.tar.xz
wayland-cb73bffed53128ed4f7a943e37c718b724199461.tar.zst
wayland-cb73bffed53128ed4f7a943e37c718b724199461.zip
client: Invoke new_id closure arguments as pointers instead of integers
This commit adds a flags parameter to wl_closure_invoke(). The so far added flags are ment to specify if the invokation is client side or server side. When on the server side, closure arguments of type 'new_id' should be invoked as a integer id while on the client side they should be invoked as a pointer to a proxy object. This fixes a bug happening when the address of a client side 'new_id' proxy object did not fit in a 32 bit integer. krh: Squashed test suite compile fix from Jason Ekstrand. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/connection.c b/src/connection.c
index e6c2b64..b952da1 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -801,7 +801,8 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
}
static void
-convert_arguments_to_ffi(const char *signature, union wl_argument *args,
+convert_arguments_to_ffi(const char *signature, uint32_t flags,
+ union wl_argument *args,
int count, ffi_type **ffi_types, void** ffi_args)
{
int i;
@@ -834,8 +835,13 @@ convert_arguments_to_ffi(const char *signature, union wl_argument *args,
ffi_args[i] = &args[i].o;
break;
case 'n':
- ffi_types[i] = &ffi_type_uint32;
- ffi_args[i] = &args[i].n;
+ if (flags & WL_CLOSURE_INVOKE_CLIENT) {
+ ffi_types[i] = &ffi_type_pointer;
+ ffi_args[i] = &args[i].o;
+ } else {
+ ffi_types[i] = &ffi_type_uint32;
+ ffi_args[i] = &args[i].n;
+ }
break;
case 'a':
ffi_types[i] = &ffi_type_pointer;
@@ -855,7 +861,7 @@ convert_arguments_to_ffi(const char *signature, union wl_argument *args,
void
-wl_closure_invoke(struct wl_closure *closure,
+wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
struct wl_object *target, void (*func)(void), void *data)
{
int count;
@@ -870,7 +876,7 @@ wl_closure_invoke(struct wl_closure *closure,
ffi_types[1] = &ffi_type_pointer;
ffi_args[1] = &target;
- convert_arguments_to_ffi(closure->message->signature, closure->args,
+ convert_arguments_to_ffi(closure->message->signature, flags, closure->args,
count, ffi_types + 2, ffi_args + 2);
ffi_prep_cif(&cif, FFI_DEFAULT_ABI,