summaryrefslogtreecommitdiffstats
path: root/src/connection.c
diff options
context:
space:
mode:
authorMathias Fiedler <mathias.fiedler@xse.de>2012-07-18 15:53:23 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-07-22 14:09:51 -0400
commit0b8b397e3438f0acad78ce2646bacc4905c97f01 (patch)
treeae6a3580dcc4168cbd54b200b329b823841a10e4 /src/connection.c
parentwayland-util: add method for reserving new object id (diff)
downloadwayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.tar
wayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.tar.gz
wayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.tar.bz2
wayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.tar.lz
wayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.tar.xz
wayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.tar.zst
wayland-0b8b397e3438f0acad78ce2646bacc4905c97f01.zip
connection: reserve id on incoming new object
If a new object id arrives ensure that there is an empty array entry created, otherwise we might get out of sync for new ids if object isn't created by interface implementation.
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/connection.c b/src/connection.c
index 5946556..f4f881e 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -756,14 +756,14 @@ wl_connection_demarshal(struct wl_connection *connection,
closure->args[i] = id;
*id = p;
- object = wl_map_lookup(objects, *p);
- if (object != NULL) {
- printf("not a new object (%d), "
+ if (wl_map_reserve_new(objects, *p) < 0) {
+ printf("not a valid new object id (%d), "
"message %s(%s)\n",
*p, message->name, message->signature);
errno = EINVAL;
goto err;
}
+
p++;
break;
case 'a':