[PATCH] shell: Do not hang when mapping a popup twice
Giulio Camuffo
giuliocamuffo at gmail.com
Sun Feb 17 08:04:43 PST 2013
When calling shell_map_popup() more than one time on the same shell_surface
the parent transform was getting added more than one time to the transform
list, resulting in an infinite loop when going through the list with
wl_list_for_each in weston_surface_update_transform_enable().
This commit removes the old transform before adding it again.
---
src/shell.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/shell.c b/src/shell.c
index ea4daa8..4aed9b4 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -182,6 +182,7 @@ struct shell_surface {
int32_t initial_up;
struct wl_seat *seat;
uint32_t serial;
+ int32_t parent_transform_active;
} popup;
struct {
@@ -1900,6 +1901,13 @@ shell_map_popup(struct shell_surface *shsurf)
struct weston_surface *es = shsurf->surface;
struct weston_surface *parent = shsurf->parent;
+ /* Remove the old transform. We don't want to add it twice
+ * otherwise Weston will go into an infinite loop when going
+ * through the transforms. */
+ if (shsurf->popup.parent_transform_active) {
+ wl_list_remove(&shsurf->popup.parent_transform.link);
+ }
+
es->output = parent->output;
shsurf->popup.grab.interface = &popup_grab_interface;
@@ -1919,6 +1927,7 @@ shell_map_popup(struct shell_surface *shsurf)
}
wl_list_insert(es->geometry.transformation_list.prev,
&shsurf->popup.parent_transform.link);
+ shsurf->popup.parent_transform_active = 1;
shsurf->popup.initial_up = 0;
weston_surface_set_position(es, shsurf->popup.x, shsurf->popup.y);
@@ -2076,6 +2085,8 @@ create_shell_surface(void *shell, struct weston_surface *surface,
shsurf->client = client;
+ shsurf->popup.parent_transform_active = 0;
+
return shsurf;
}
--
1.8.1.3
More information about the wayland-devel
mailing list