wok-current view openbox/stuff/9ed6fdd71890c5cc43747f105382d5677e5d37e7.patch @ rev 25714
fix plugins path on abiword receipt
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Fri Jun 14 11:38:57 2024 +0000 (6 months ago) |
parents | |
children |
line source
1 From 9ed6fdd71890c5cc43747f105382d5677e5d37e7 Mon Sep 17 00:00:00 2001
2 From: pldubouilh <pldubouilh@gmail.com>
3 Date: Fri, 17 Mar 2023 18:23:47 +0100
4 Subject: [PATCH] Fix list traversal issue in client_calc_layer
6 The calls to client_calc_layer_internal can modify stacking_list, which
7 can cause us to follow dangling ->next pointers (either by the pointer
8 itself already being freed, or it pointing to a freed area). Avoid this
9 by copying the list first, the goal is to visit every client in the list
10 once so this should be fine.
11 ---
12 openbox/client.c | 9 +++++++--
13 1 file changed, 7 insertions(+), 2 deletions(-)
15 diff --git a/openbox/client.c b/openbox/client.c
16 index 7168b2407..b8264587c 100644
17 --- a/openbox/client.c
18 +++ b/openbox/client.c
19 @@ -2742,9 +2742,12 @@ static void client_calc_layer_internal(ObClient *self)
20 void client_calc_layer(ObClient *self)
21 {
22 GList *it;
23 + /* the client_calc_layer_internal calls below modify stacking_list,
24 + so we have to make a copy to iterate over */
25 + GList *list = g_list_copy(stacking_list);
27 /* skip over stuff above fullscreen layer */
28 - for (it = stacking_list; it; it = g_list_next(it))
29 + for (it = list; it; it = g_list_next(it))
30 if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break;
32 /* find the windows in the fullscreen layer, and mark them not-visited */
33 @@ -2757,7 +2760,7 @@ void client_calc_layer(ObClient *self)
34 client_calc_layer_internal(self);
36 /* skip over stuff above fullscreen layer */
37 - for (it = stacking_list; it; it = g_list_next(it))
38 + for (it = list; it; it = g_list_next(it))
39 if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break;
41 /* now recalc any windows in the fullscreen layer which have not
42 @@ -2768,6 +2771,8 @@ void client_calc_layer(ObClient *self)
43 !WINDOW_AS_CLIENT(it->data)->visited)
44 client_calc_layer_internal(it->data);
45 }
46 +
47 + g_list_free(it);
48 }
50 gboolean client_should_show(ObClient *self)