[PATCH] server: fix invalid read and object id removal
Tiago Vignatti
tiago.vignatti at intel.com
Sun Oct 9 11:35:19 PDT 2011
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
src/wayland-server.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 4ee7796..0ce335d 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -299,12 +299,15 @@ static void
destroy_resource(void *element, void *data)
{
struct wl_resource *resource = element;
+ struct wl_client *client = resource->client;
struct wl_listener *l, *next;
uint32_t *time = data;
wl_list_for_each_safe(l, next, &resource->destroy_listener_list, link)
l->func(l, resource, *time);
+ wl_map_remove(&client->objects, resource->object.id);
+
if (resource->destroy)
resource->destroy(resource);
}
@@ -312,10 +315,7 @@ destroy_resource(void *element, void *data)
WL_EXPORT void
wl_resource_destroy(struct wl_resource *resource, uint32_t time)
{
- struct wl_client *client = resource->client;
-
destroy_resource(resource, &time);
- wl_map_insert_at(&client->objects, resource->object.id, NULL);
}
WL_EXPORT void
--
1.7.2.2
More information about the wayland-devel
mailing list