From 0b8b397e3438f0acad78ce2646bacc4905c97f01 Mon Sep 17 00:00:00 2001 From: Mathias Fiedler Date: Wed, 18 Jul 2012 15:53:23 +0200 Subject: [PATCH] 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. --- src/connection.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/connection.c b/src/connection.c index 59465563..f4f881ed 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':