Commit 4f9cf6ec authored by Kristian Høgsberg's avatar Kristian Høgsberg
Browse files

Fix typecheck in case of multiple instances of type meta data

In most cases the pointer equality test is sufficient.  However, in
some cases, depending on how things are split across shared objects,
we can end up with multiple instances of the interface metadata
constants.  So if the pointers match, the interfaces are equal, if
they don't match we have to compare the interface names.
parent e0680250
......@@ -806,6 +806,19 @@ wl_connection_demarshal(struct wl_connection *connection,
return NULL;
}
static int
interface_equal(const struct wl_interface *a, const struct wl_interface *b)
{
/* In most cases the pointer equality test is sufficient.
* However, in some cases, depending on how things are split
* across shared objects, we can end up with multiple
* instances of the interface metadata constants. So if the
* pointers match, the interfaces are equal, if they don't
* match we have to compare the interface names. */
return a == b || strcmp(a->name, b->name) == 0;
}
int
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
{
......@@ -839,7 +852,8 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
}
if (*object != NULL && message->types[i-2] != NULL &&
(*object)->interface != message->types[i-2]) {
!interface_equal((*object)->interface,
message->types[i-2])) {
printf("invalid object (%u), type (%s), "
"message %s(%s)\n",
id, (*object)->interface->name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment