On Thu, Oct 11, 2012 at 02:20:28PM +0300, Ander Conselvan de Oliveira wrote: > 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.
Ah, yes, very nice. One less entry point and one less double-locking bug. Kristian > [1] commit 9de9e39f87adfce1ea9755e394928756254c0ba2 > Author: Kristian Høgsberg <[email protected]> > Date: Thu Jun 28 22:01:58 2012 -0400 > > Allocate client proxy automatically for new objects > --- > src/wayland-client.c | 5 ++--- > src/wayland-client.h | 3 --- > 2 files changed, 2 insertions(+), 6 deletions(-) > > diff --git a/src/wayland-client.c b/src/wayland-client.c > index c007f4c..f06407d 100644 > --- a/src/wayland-client.c > +++ b/src/wayland-client.c > @@ -117,7 +117,8 @@ wl_display_create_queue(struct wl_display *display) > return queue; > } > > -WL_EXPORT struct wl_proxy * > +/* The caller should hold the display lock */ > +static struct wl_proxy * > wl_proxy_create(struct wl_proxy *factory, const struct wl_interface > *interface) > { > struct wl_proxy *proxy; > @@ -133,10 +134,8 @@ wl_proxy_create(struct wl_proxy *factory, const struct > wl_interface *interface) > proxy->queue = factory->queue; > proxy->id_deleted = 0; > > - pthread_mutex_lock(&display->mutex); > proxy->object.id = wl_map_insert_new(&display->objects, > WL_MAP_CLIENT_SIDE, proxy); > - pthread_mutex_unlock(&display->mutex); > > return proxy; > } > diff --git a/src/wayland-client.h b/src/wayland-client.h > index f064010..cb1be9c 100644 > --- a/src/wayland-client.h > +++ b/src/wayland-client.h > @@ -39,9 +39,6 @@ void wl_event_queue_destroy(struct wl_event_queue *queue); > void wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); > struct wl_proxy *wl_proxy_create(struct wl_proxy *factory, > const struct wl_interface *interface); > -struct wl_proxy *wl_proxy_create_for_id(struct wl_proxy *factory, > - uint32_t id, > - const struct wl_interface *interface); > > void wl_proxy_destroy(struct wl_proxy *proxy); > int wl_proxy_add_listener(struct wl_proxy *proxy, > -- > 1.7.9.5 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
