client: Fix double locking bug

The function wl_proxy_create_for_id() would try to acquire the display
lock, but the only call path leading to it would call it with the lock
already acquired.

This patch removes the attempt to acquire the lock and makes the
function static. It was exported before because client had to create
proxy's manually when the server sent a new object id, but since commit
9de9e39f [1] this is no longer necessary.

[1] commit 9de9e39f87
    Author: Kristian Høgsberg <krh@bitplanet.net>
    Date:   Thu Jun 28 22:01:58 2012 -0400

        Allocate client proxy automatically for new objects

v2: Change the right function. Previous patch changed wl_proxy_create()
    instead of wl_proxy_create_for_id().
This commit is contained in:
Ander Conselvan de Oliveira 2012-10-11 14:55:59 +03:00 committed by Kristian Høgsberg
parent eb5fae3226
commit ff4afd6c0c
2 changed files with 2 additions and 6 deletions

View file

@ -141,7 +141,8 @@ wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)
return proxy;
}
WL_EXPORT struct wl_proxy *
/* The caller should hold the display lock */
static struct wl_proxy *
wl_proxy_create_for_id(struct wl_proxy *factory,
uint32_t id, const struct wl_interface *interface)
{
@ -159,9 +160,7 @@ wl_proxy_create_for_id(struct wl_proxy *factory,
proxy->queue = factory->queue;
proxy->id_deleted = 0;
pthread_mutex_lock(&display->mutex);
wl_map_insert_at(&display->objects, id, proxy);
pthread_mutex_unlock(&display->mutex);
return proxy;
}