<div dir="ltr">How does it crash? And when doing what?<div><br></div><div>Giulio</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/15 Axel Davy <span dir="ltr"><<a href="mailto:davy@clipper.ens.fr" target="_blank">davy@clipper.ens.fr</a>></span><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"><br>
This patch makes XWayland often crash for me.<br>
<br>
Axel Davy<br>
<br>
Le 11/09/2013 18:20, Giulio Camuffo a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
add a new function pointer to the weston_shell_interface struct that<br>
shells will set accordingly.<br>
---<br>
  src/compositor.h              |  2 ++<br>
  src/shell.c                   | 11 +++++++++--<br>
  src/xwayland/window-manager.c | 11 +++++++++++<br>
  3 files changed, 22 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compositor.h b/src/compositor.h<br>
index 3c1b643..ead0c91 100644<br>
--- a/src/compositor.h<br>
+++ b/src/compositor.h<br>
@@ -107,6 +107,8 @@ struct weston_shell_interface {<br>
        int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);<br>
        int (*resize)(struct shell_surface *shsurf,<br>
                      struct weston_seat *ws, uint32_t edges);<br>
+       void (*set_title)(struct shell_surface *shsurf,<br>
+                         const char *title);<br>
<br>
  };<br>
<br>
diff --git a/src/shell.c b/src/shell.c<br>
index dc15bfa..ea4315a 100644<br>
--- a/src/shell.c<br>
+++ b/src/shell.c<br>
@@ -1595,13 +1595,19 @@ shell_surface_pong(struct wl_client *client, struct wl_resource *resource,<br>
  }<br>
<br>
  static void<br>
+set_title(struct shell_surface *shsurf, const char *title)<br>
+{<br>
+       free(shsurf->title);<br>
+       shsurf->title = strdup(title);<br>
+}<br>
+<br>
+static void<br>
  shell_surface_set_title(struct wl_client *client,<br>
                        struct wl_resource *resource, const char *title)<br>
  {<br>
        struct shell_surface *shsurf = wl_resource_get_user_data(<u></u>resource);<br>
<br>
-       free(shsurf->title);<br>
-       shsurf->title = strdup(title);<br>
+       set_title(shsurf, title);<br>
  }<br>
<br>
  static void<br>
@@ -4583,6 +4589,7 @@ module_init(struct weston_compositor *ec,<br>
        ec->shell_interface.set_<u></u>xwayland = set_xwayland;<br>
        ec->shell_interface.move = surface_move;<br>
        ec->shell_interface.resize = surface_resize;<br>
+       ec->shell_interface.set_title = set_title;<br>
<br>
        wl_list_init(&shell->input_<u></u>panel.surfaces);<br>
<br>
diff --git a/src/xwayland/window-manager.<u></u>c b/src/xwayland/window-manager.<u></u>c<br>
index f775734..b4f64d3 100644<br>
--- a/src/xwayland/window-manager.<u></u>c<br>
+++ b/src/xwayland/window-manager.<u></u>c<br>
@@ -363,6 +363,8 @@ static void<br>
  weston_wm_window_read_<u></u>properties(struct weston_wm_window *window)<br>
  {<br>
        struct weston_wm *wm = window->wm;<br>
+       struct weston_shell_interface *shell_interface =<br>
+               &wm->server->compositor-><u></u>shell_interface;<br>
<br>
  #define F(field) offsetof(struct weston_wm_window, field)<br>
        const struct {<br>
@@ -468,6 +470,9 @@ weston_wm_window_read_<u></u>properties(struct weston_wm_window *window)<br>
                }<br>
                free(reply);<br>
        }<br>
+<br>
+       if (window->shsurf && window->name)<br>
+               shell_interface->set_title(<u></u>window->shsurf, window->name);<br>
  }<br>
<br>
  static void<br>
@@ -1875,6 +1880,9 @@ surface_destroy(struct wl_listener *listener, void *data)<br>
<br>
        wm_log("surface for xid %d destroyed\n", window->id);<br>
<br>
+       /* This should have been freed by the shell.<br>
+       Don't try to use it later. */<br>
+       window->shsurf = NULL;<br>
        window->surface = NULL;<br>
  }<br>
<br>
@@ -2029,6 +2037,9 @@ xserver_map_shell_surface(<u></u>struct weston_wm *wm,<br>
                                                      window->surface,<br>
                                                      &shell_client);<br>
<br>
+       if (window->name)<br>
+               shell_interface->set_title(<u></u>window->shsurf, window->name);<br>
+<br>
        if (window->fullscreen) {<br>
                window->saved_width = window->width;<br>
                window->saved_height = window->height;<br>
</blockquote>
<br>
<br>
<br></div></div>
______________________________<u></u>_________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">wayland-devel@lists.<u></u>freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/wayland-devel</a><br>
</blockquote></div><br></div>