<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 22 August 2014 12:56, 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 Fri, 18 Jul 2014 17:56:36 +0200<br>
Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>> wrote:<br>
<br>
> We won't receive any response anyway...<br>
><br>
> This removes the last line of:<br>
><br>
> [2230782.435] wl_display@1.error(wl_display@1, 2, "no memory")<br>
> wl_display@1: error 2: no memory<br>
> [2230782.534] -> wl_display@1.sync(new id wl_callback@3)<br>
><br>
> and prevents from creating proxy on invalidated display object.<br>
> ---<br>
> src/wayland-client.c | 6 ++++++<br>
> 1 file changed, 6 insertions(+)<br>
><br>
> diff --git a/src/wayland-client.c b/src/wayland-client.c<br>
> index ee2215d..2f52900 100644<br>
> --- a/src/wayland-client.c<br>
> +++ b/src/wayland-client.c<br>
> @@ -312,6 +312,9 @@ wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)<br>
> struct wl_display *display = factory->display;<br>
> struct wl_proxy *proxy;<br>
><br>
> + if (display->last_error)<br>
> + return NULL;<br>
> +<br>
> pthread_mutex_lock(&display->mutex);<br>
> proxy = proxy_create(factory, interface);<br>
> pthread_mutex_unlock(&display->mutex);<br>
> @@ -523,6 +526,9 @@ wl_proxy_marshal_array_constructor(struct wl_proxy *proxy,<br>
> struct wl_proxy *new_proxy = NULL;<br>
> const struct wl_message *message;<br>
><br>
> + if (proxy->display->last_error)<br>
> + return NULL;<br>
> +<br>
> pthread_mutex_lock(&proxy->display->mutex);<br>
><br>
> message = &proxy->object.interface->methods[opcode];<br>
<br>
</div></div>Hi,<br>
<br>
I think last_error needs to be checked under the display mutex.<br></blockquote><div><br></div><div>Yes<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm also not so sure about this whole change, because I believe apps<br>
expect the wl_proxy creation to succeed, and assume that if it fails,<br>
it is due to memory allocation failure. The reponse to memory<br>
allocation failure may be just abort(), while the response to a<br>
protocol error could include saving current work to a temporary file.<br>
<br>
AFAICS, the only way to get NULL right now is a memory allocation<br>
error, and I think that things like glib just abort if malloc ever<br>
fails, so it is conceivable Gtk and apps will do that too. Whether they<br>
actually handle protocol errors differently, I don't know, but at least<br>
a protocol error is much more recoverable than a malloc failure.<br>
<br>
Creating more proxies after the wl_display is already disconnected<br>
should not hurt, right? <br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I need a second opinion before taking this in. Am I making any sense?<br></blockquote><div><br>Yes, I understand, it makes sense. Let's discard this patch,<br>since there are no troubles with the proxies now. If one day there are,<br>
we can start solving it again.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Thanks,<br>
pq<br>
</blockquote></div><br></div><div class="gmail_extra">Thanks,<br>Marek<br></div></div>