Commit b4cf9e7d authored by Derek Foreman's avatar Derek Foreman Committed by Daniel Stone

util: Pass flags to map iterators

On the client side we're going to need to know if an object from the
map is a zombie before we attempt to dereference it, so we need to
pass this to the iterator.
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
Signed-off-by: default avatarDerek Foreman <derekf@osg.samsung.com>
parent 46e4ea43
......@@ -80,7 +80,8 @@ struct wl_map {
};
typedef enum wl_iterator_result (*wl_iterator_func_t)(void *element,
void *data);
void *data,
uint32_t flags);
void
wl_map_init(struct wl_map *map, uint32_t side);
......
......@@ -658,11 +658,9 @@ resource_is_deprecated(struct wl_resource *resource)
}
static enum wl_iterator_result
destroy_resource(void *element, void *data)
destroy_resource(void *element, void *data, uint32_t flags)
{
struct wl_resource *resource = element;
struct wl_client *client = resource->client;
uint32_t flags;
wl_signal_emit(&resource->deprecated_destroy_signal, resource);
/* Don't emit the new signal for deprecated resources, as that would
......@@ -670,7 +668,6 @@ destroy_resource(void *element, void *data)
if (!resource_is_deprecated(resource))
wl_priv_signal_emit(&resource->destroy_signal, resource);
flags = wl_map_lookup_flags(&client->objects, resource->object.id);
if (resource->destroy)
resource->destroy(resource);
......@@ -685,9 +682,11 @@ wl_resource_destroy(struct wl_resource *resource)
{
struct wl_client *client = resource->client;
uint32_t id;
uint32_t flags;
id = resource->object.id;
destroy_resource(resource, NULL);
flags = wl_map_lookup_flags(&client->objects, id);
destroy_resource(resource, NULL, flags);
if (id < WL_SERVER_ID_START) {
if (client->display_resource) {
......@@ -1839,7 +1838,7 @@ struct wl_resource_iterator_context {
};
static enum wl_iterator_result
resource_iterator_helper(void *res, void *user_data)
resource_iterator_helper(void *res, void *user_data, uint32_t flags)
{
struct wl_resource_iterator_context *context = user_data;
struct wl_resource *resource = res;
......
......@@ -371,7 +371,7 @@ for_each_helper(struct wl_array *entries, wl_iterator_func_t func, void *data)
for (p = start; p < end; p++)
if (p->data && !map_entry_is_free(*p)) {
ret = func(map_entry_get_data(*p), data);
ret = func(map_entry_get_data(*p), data, map_entry_get_flags(*p));
if (ret != WL_ITERATOR_CONTINUE)
break;
}
......
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