aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-06-24 15:19:05 +0200
committerSimon Ser <contact@emersion.fr>2020-06-25 10:33:58 +0200
commit86e20f48c6643cdbf642baa2cd7ac371c2d187e8 (patch)
tree49d2f4229d19d5bdff6b32930f76e2afddb51a8b
parentb937c7b05e507b861499965434d09cf526d83cde (diff)
xdg-shell: handle serial wrapping overflow
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c18
-rw-r--r--types/xdg_shell_v6/wlr_xdg_surface_v6.c16
2 files changed, 21 insertions, 13 deletions
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index eb68c14c..7cd12040 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -107,17 +107,13 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
return;
}
+ // First find the ack'ed configure
bool found = false;
struct wlr_xdg_surface_configure *configure, *tmp;
- wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) {
- if (configure->serial < serial) {
- wlr_signal_emit_safe(&surface->events.ack_configure, configure);
- xdg_surface_configure_destroy(configure);
- } else if (configure->serial == serial) {
+ wl_list_for_each(configure, &surface->configure_list, link) {
+ if (configure->serial == serial) {
found = true;
break;
- } else {
- break;
}
}
if (!found) {
@@ -126,6 +122,14 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
"wrong configure serial: %u", serial);
return;
}
+ // Then remove old configures from the list
+ wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) {
+ if (configure->serial == serial) {
+ break;
+ }
+ wlr_signal_emit_safe(&surface->events.ack_configure, configure);
+ xdg_surface_configure_destroy(configure);
+ }
switch (surface->role) {
case WLR_XDG_SURFACE_ROLE_NONE:
diff --git a/types/xdg_shell_v6/wlr_xdg_surface_v6.c b/types/xdg_shell_v6/wlr_xdg_surface_v6.c
index ed87d6fe..d9559b98 100644
--- a/types/xdg_shell_v6/wlr_xdg_surface_v6.c
+++ b/types/xdg_shell_v6/wlr_xdg_surface_v6.c
@@ -156,16 +156,13 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
return;
}
+ // First find the ack'ed configure
bool found = false;
struct wlr_xdg_surface_v6_configure *configure, *tmp;
- wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) {
- if (configure->serial < serial) {
- xdg_surface_configure_destroy(configure);
- } else if (configure->serial == serial) {
+ wl_list_for_each(configure, &surface->configure_list, link) {
+ if (configure->serial == serial) {
found = true;
break;
- } else {
- break;
}
}
if (!found) {
@@ -174,6 +171,13 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
"wrong configure serial: %u", serial);
return;
}
+ // Then remove old configures from the list
+ wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) {
+ if (configure->serial == serial) {
+ break;
+ }
+ xdg_surface_configure_destroy(configure);
+ }
switch (surface->role) {
case WLR_XDG_SURFACE_V6_ROLE_NONE: