summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Lee <kwangwoong.lee@lge.com>2015-07-31 18:02:54 +0900
committerDaniel Stone <daniels@collabora.com>2015-08-06 08:46:56 +0100
commit441f9bb144efd561f0ac4bc4e672acc9703b5126 (patch)
tree6f956095e8e19ffa505ab65c85dc30ab723ae559
parentbbe6795d9b36efd59a3468cbfd6a5eb735ad1ad1 (diff)
downloadwayland-441f9bb144efd561f0ac4bc4e672acc9703b5126.tar.gz
wayland-client : Fix queue_release not to call proxy_destroy
proxy_destroy could be called twice by wl_proxy_destroy and wl_event_queue_release. Then, wl_map_remove was called twice for same object id. Signed-off-by: Elvis Lee <kwangwoong.lee@lge.com> Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--src/wayland-client.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 6450b67..09c594a 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -259,6 +259,7 @@ wl_event_queue_release(struct wl_event_queue *queue)
{
struct wl_closure *closure;
struct wl_proxy *proxy;
+ bool proxy_destroyed;
while (!wl_list_empty(&queue->event_list)) {
closure = container_of(queue->event_list.next,
@@ -268,10 +269,11 @@ wl_event_queue_release(struct wl_event_queue *queue)
decrease_closure_args_refcount(closure);
proxy = closure->proxy;
- if (proxy->refcount == 1)
- proxy_destroy(proxy);
- else
- --proxy->refcount;
+ proxy_destroyed = !!(proxy->flags & WL_PROXY_FLAG_DESTROYED);
+
+ proxy->refcount--;
+ if (proxy_destroyed && !proxy->refcount)
+ free(proxy);
wl_closure_destroy(closure);
}