<div dir="ltr"><div>I think this is ok.  To my knowledge, no one is re-binding wl_display or even relying on that global being exposed.<br></div>--Jason<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 7, 2014 at 6:55 AM, Jasper St. Pierre <span dir="ltr"><<a href="mailto:jstpierre@mecheye.net" target="_blank">jstpierre@mecheye.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The idea here was that once upon a time, clients could rebind wl_display<br>
to a higher version, so we offered the ability to rebind it<br>
here. However, this is particularly broken. The existing bind<br>
implementation actually still hardcodes version numbers, and it leaks<br>
previous resources, overwriting the existing one.<br>
<br>
The newly bound resource *also* won't have any listeners attached by the<br>
client, meaning that the error and delete_id events won't get delivered<br>
correctly. Unless the client poked into libwayland internals, it also<br>
can't possibly set up these handlers correctly either, so the client<br>
will sustain errors and leak all deleted globals.<br>
<br>
Since this never worked correctly in the first place, we can feel safe<br>
removing it.<br>
---<br>
 src/wayland-server.c | 28 ++++++++--------------------<br>
 1 file changed, 8 insertions(+), 20 deletions(-)<br>
<br>
diff --git a/src/wayland-server.c b/src/wayland-server.c<br>
index 3c162d4..dc3f502 100644<br>
--- a/src/wayland-server.c<br>
+++ b/src/wayland-server.c<br>
@@ -380,9 +380,8 @@ wl_client_get_display(struct wl_client *client)<br>
        return client->display;<br>
 }<br>
<br>
-static void<br>
-bind_display(struct wl_client *client,<br>
-            void *data, uint32_t version, uint32_t id);<br>
+static int<br>
+bind_display(struct wl_client *client, struct wl_display *display);<br>
<br>
 /** Create a client for the given file descriptor<br>
  *<br>
@@ -440,9 +439,7 @@ wl_client_create(struct wl_display *display, int fd)<br>
                goto err_map;<br>
<br>
        wl_signal_init(&client->destroy_signal);<br>
-       bind_display(client, display, 1, 1);<br>
-<br>
-       if (!client->display_resource)<br>
+       if (bind_display(client, display) < 0)<br>
                goto err_map;<br>
<br>
        wl_list_insert(display->client_list.prev, &client->link);<br>
@@ -772,22 +769,20 @@ destroy_client_display_resource(struct wl_resource *resource)<br>
        resource->client->display_resource = NULL;<br>
 }<br>
<br>
-static void<br>
-bind_display(struct wl_client *client,<br>
-            void *data, uint32_t version, uint32_t id)<br>
+static int<br>
+bind_display(struct wl_client *client, struct wl_display *display)<br>
 {<br>
-       struct wl_display *display = data;<br>
-<br>
        client->display_resource =<br>
-               wl_resource_create(client, &wl_display_interface, 1, id);<br>
+               wl_resource_create(client, &wl_display_interface, 1, 1);<br>
        if (client->display_resource == NULL) {<br>
                wl_client_post_no_memory(client);<br>
-               return;<br>
+               return -1;<br>
        }<br>
<br>
        wl_resource_set_implementation(client->display_resource,<br>
                                       &display_interface, display,<br>
                                       destroy_client_display_resource);<br>
+       return 0;<br>
 }<br>
<br>
 /** Create Wayland display object.<br>
@@ -831,13 +826,6 @@ wl_display_create(void)<br>
<br>
        wl_array_init(&display->additional_shm_formats);<br>
<br>
-       if (!wl_global_create(display, &wl_display_interface, 1,<br>
-                             display, bind_display)) {<br>
-               wl_event_loop_destroy(display->loop);<br>
-               free(display);<br>
-               return NULL;<br>
-       }<br>
-<br>
        return display;<br>
 }<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.0.4<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>