<div dir="ltr"><div>The issues I pointed out are not anything big. I'll send a patch that removes wl_display_dispatch_pending from both test-cases and I noticed that there are more leaks it the queue-test, so I'll get rid of them all in another patch if it's OK :)<br>
<br></div>Thanks,<br>Marek<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 August 2014 10:57, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, 21 Aug 2014 10:46:55 +0200<br>
Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
><br>
> On 20 August 2014 18:29, Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>> wrote:<br>
><br>
> > ---<br>
> >  tests/queue-test.c | 62<br>
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>
> >  1 file changed, 62 insertions(+)<br>
> ><br>
> > diff --git a/tests/queue-test.c b/tests/queue-test.c<br>
> > index a4b165d..fc8a920 100644<br>
> > --- a/tests/queue-test.c<br>
> > +++ b/tests/queue-test.c<br>
> > @@ -158,6 +158,63 @@ client_test_multiple_queues(void)<br>
> >  }<br>
> ><br>
> >  static void<br>
> > +sync_callback_roundtrip(void *data, struct wl_callback *callback,<br>
> > uint32_t serial)<br>
> > +{<br>
> > +       bool *done = data;<br>
> > +       *done = true;<br>
> > +}<br>
> > +<br>
> > +static const struct wl_callback_listener sync_listener_roundtrip = {<br>
> > +       sync_callback_roundtrip<br>
> > +};<br>
> > +<br>
> > +/* Test that doing a roundtrip on a queue only the events on that<br>
> > + * queue get dispatched. */<br>
> > +static int<br>
> > +client_test_queue_roundtrip(void)<br>
> > +{<br>
> > +       struct wl_event_queue *queue;<br>
> > +       struct wl_callback *callback1;<br>
> > +       struct wl_callback *callback2;<br>
> > +       struct wl_display *display;<br>
> > +<br>
> > +       display = wl_display_connect(SOCKET_NAME);<br>
> > +       client_assert(display);<br>
> > +<br>
> > +       /* Make the current thread the display thread. This is because<br>
> > +        * wl_display_dispatch_queue() will only read the display fd if<br>
> > +        * the main display thread has been set. */<br>
> > +       wl_display_dispatch_pending(display);<br>
> ><br>
><br>
> I don't think this is necessary,  this behavior was introduced in<br>
>  385fe30e8b144a968aa88c6546c2ef247771b3d7 and<br>
> 78cfa967681c965d23f6cbf76e080bbb0b564ff6<br>
> and it was removed<br>
> in 3c7e8bfbb4745315b7bcbf69fa746c3d6718c305 (now there's only unused<br>
> variable display_thread in wl_display structure, we were discussing it back<br>
> on the list IIRC).<br>
><br>
> ><br>
> > +       queue = wl_display_create_queue(display);<br>
> > +       client_assert(queue);<br>
> > +<br>
> > +       bool done1 = false;<br>
> > +       callback1 = wl_display_sync(display);<br>
> > +       assert(callback1 != NULL);<br>
> > +       wl_callback_add_listener(callback1, &sync_listener_roundtrip,<br>
> > &done1);<br>
> > +<br>
> > +       bool done2 = false;<br>
> > +       callback2 = wl_display_sync(display);<br>
> > +       assert(callback2 != NULL);<br>
> > +       wl_callback_add_listener(callback2, &sync_listener_roundtrip,<br>
> > &done2);<br>
> > +       wl_proxy_set_queue((struct wl_proxy *) callback2, queue);<br>
> > +<br>
> > +       wl_display_roundtrip(display);<br>
> > +       client_assert(done1 == true);<br>
> > +       client_assert(done2 == false);<br>
> > +<br>
> > +       wl_display_roundtrip_queue(display, queue);<br>
> > +       client_assert(done2 == true);<br>
> > +<br>
> > +       wl_callback_destroy(callback1);<br>
> > +       wl_callback_destroy(callback2);<br>
> ><br>
><br>
> You're leaking the queue here.<br>
><br>
><br>
> > +       wl_display_disconnect(display);<br>
> > +<br>
> > +       return 0;<br>
> > +}<br>
> > +<br>
> > +static void<br>
> >  client_alarm_handler(int sig)<br>
> >  {<br>
> >         fprintf(stderr, "Received SIGALRM signal, aborting.\n");<br>
> > @@ -199,6 +256,11 @@ client_main(int fd)<br>
> >                 return EXIT_FAILURE;<br>
> >         }<br>
> ><br>
> > +       if (client_test_queue_roundtrip() != 0) {<br>
> > +               fprintf(stderr, "queue rountrip test failed\n");<br>
> > +               return EXIT_FAILURE;<br>
> > +       }<br>
> > +<br>
> >         return EXIT_SUCCESS;<br>
> >  }<br>
> ><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>
> ><br>
><br>
> Otherwise:<br>
><br>
> Reviewed-by: Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>><br>
<br>
</div></div>Oops, just pushed it already. Anyone care to follow up? :-)<br>
<br>
<br>
Thanks,<br>
pq<br>
</blockquote></div><br></div>