<div dir="ltr"><div>Thanks. I just pushed this (with a small fix to change the variable name from "surface" to "id").<br></div>--Jason Ekstrand<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Jul 20, 2014 at 1:10 AM, Boyan Ding <span dir="ltr"><<a href="mailto:stu_dby@126.com" target="_blank">stu_dby@126.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Only when reading through mails today did I find I had duplicated<br>
efforts [1], sorry.<br>
<br>
This patch is<br>
Reviewed-by: Boyan Ding <<a href="mailto:stu_dby@126.com">stu_dby@126.com</a>><br>
<br>
[1]<br>
<a href="http://lists.freedesktop.org/archives/wayland-devel/2014-July/015943.html" target="_blank">http://lists.freedesktop.org/archives/wayland-devel/2014-July/015943.html</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, 2014-07-02 at 15:00 -0700, Tyler Veness wrote:<br>
> When Xwayland requests that a wl_surface be created and the X event is<br>
> handled before the wayland requests, a surface ID is stored to<br>
> window->surface_id and the window is added to the unpaired window list. When<br>
> weston_wm_create_surface is called, the window is removed from the list and<br>
> window->surface_id is set to zero. If window->surface_id is not zero when<br>
> weston_wm_window_destroy is called, the window is assumed to be in the<br>
> unpaired window list and wl_list_remove is called. If<br>
> weston_wm_window_handle_surface_id is called and the surface has already<br>
> been created, the window is not added to the unpaired window list, but<br>
> window->surface_id isn't set to zero. When the window is destroyed, removing<br>
> the window from the list is attempted anyway and a crash occurs.<br>
><br>
> This patch stores the surface ID in a temporary variable and only assigns it<br>
> to window->surface_id when the window is added to the unpaired window list.<br>
> Otherwise window->surface_id is set to zero to maintain its use as a flag<br>
> variable.<br>
><br>
> Fixes: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=80273" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=80273</a><br>
> Signed-off-by: Tyler Veness <<a href="mailto:calcmogul@gmail.com">calcmogul@gmail.com</a>><br>
> ---<br>
> xwayland/window-manager.c | 13 ++++++++-----<br>
> 1 file changed, 8 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c<br>
> index 2fb65b1..4c98baf 100644<br>
> --- a/xwayland/window-manager.c<br>
> +++ b/xwayland/window-manager.c<br>
> @@ -1374,14 +1374,17 @@ weston_wm_window_handle_surface_id(struct weston_wm_window *window,<br>
> * hasn't been created yet. In that case put the window on<br>
> * the unpaired window list and continue when the surface gets<br>
> * created. */<br>
> - window->surface_id = client_message->data.data32[0];<br>
> - resource = wl_client_get_object(wm->server->client,<br>
> - window->surface_id);<br>
> - if (resource)<br>
> + uint32_t surface = client_message->data.data32[0];<br>
> + resource = wl_client_get_object(wm->server->client, surface);<br>
> + if (resource) {<br>
> + window->surface_id = 0;<br>
> xserver_map_shell_surface(window,<br>
> wl_resource_get_user_data(resource));<br>
> - else<br>
> + }<br>
> + else {<br>
> + window->surface_id = surface;<br>
> wl_list_insert(&wm->unpaired_window_list, &window->link);<br>
> + }<br>
> }<br>
><br>
> static void<br>
<br>
<br>
<br>
</div></div><div class="HOEnZb"><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br></div>