[PATCH] shell: Destroy the shell_surface when the xdg_shell interface gets destroyed

Sjoerd Simons sjoerd.simons at collabora.co.uk
Wed Jun 4 04:44:45 PDT 2014

When running gtk3-demo under weston opening comboboxes a second time
causes the program to bail due to weston returning an error. The
relevant client trace in this case is:
 -> xdg_shell at 15.get_xdg_popup(new id xdg_popup at 12, wl_surface at 28, ....
 -> xdg_popup at 12.destroy()
 -> xdg_shell at 15.get_xdg_popup(new id xdg_popup at 19, wl_surface at 28, ....
  wl_display at 1.error(wl_surface at 28, 0,
    "xdg_shell::get_xdg_popup already requested")

However, according to the xdg_shell protocol this should be valid as
calling destroy should remove the xdg_popup interface from the
wl_surface object.

Fix this by ensuring the internal shell surface also gets destroyed when
the relevant xdg interface is destroyed and not just when the underlying
wl_surface gets destroyed.

This patch applies both to Weston 1.5 and master, please apply to both
if correct.
 desktop-shell/shell.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 46c6e18..45a3321 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3153,6 +3153,7 @@ destroy_shell_surface(struct shell_surface *shsurf)
 	/* As destroy_resource() use wl_list_for_each_safe(),
 	 * we can always remove the listener.
+	wl_list_remove(&shsurf->resource_destroy_listener.link);
 	shsurf->surface->configure = NULL;
@@ -3175,6 +3176,7 @@ shell_destroy_shell_surface(struct wl_resource *resource)
 	if (!wl_list_empty(&shsurf->popup.grab_link))
 	shsurf->resource = NULL;
+	destroy_shell_surface(shsurf);
 static void

More information about the wayland-devel mailing list