Browse Source

Fix recursive enterleave ignore (#1747)

Every call to client_ignore_enterleave_events() must be paired with a
following call to client_restore_enterleave_events(). In between these
two calls, no other calls to client_ignore_enterleave_events() is
allowed.

The code in banning_refresh() sometimes broke these rules. This can
happen because the code causes signals to be emitted and Lua code can do
basically anything.

Fix this by moving the calls into the called functions.

Fixes: https://github.com/awesomeWM/awesome/issues/1746
Signed-off-by: Uli Schlachter <psychon@znc.in>
Uli Schlachter 2 years ago
parent
commit
7481a6e6b8
2 changed files with 4 additions and 4 deletions
  1. 0
    4
      banning.c
  2. 4
    0
      objects/client.c

+ 0
- 4
banning.c View File

@@ -52,8 +52,6 @@ banning_refresh(void)
52 52
 
53 53
     globalconf.need_lazy_banning = false;
54 54
 
55
-    client_ignore_enterleave_events();
56
-
57 55
     foreach(c, globalconf.clients)
58 56
         if(client_isvisible(*c))
59 57
             client_unban(*c);
@@ -63,8 +61,6 @@ banning_refresh(void)
63 61
     foreach(c, globalconf.clients)
64 62
         if(!client_isvisible(*c))
65 63
             client_ban(*c);
66
-
67
-    client_restore_enterleave_events();
68 64
 }
69 65
 
70 66
 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

+ 4
- 0
objects/client.c View File

@@ -1059,7 +1059,9 @@ client_ban(client_t *c)
1059 1059
 {
1060 1060
     if(!c->isbanned)
1061 1061
     {
1062
+        client_ignore_enterleave_events();
1062 1063
         xcb_unmap_window(globalconf.connection, c->frame_window);
1064
+        client_restore_enterleave_events();
1063 1065
 
1064 1066
         c->isbanned = true;
1065 1067
 
@@ -2130,7 +2132,9 @@ client_unban(client_t *c)
2130 2132
     lua_State *L = globalconf_get_lua_State();
2131 2133
     if(c->isbanned)
2132 2134
     {
2135
+        client_ignore_enterleave_events();
2133 2136
         xcb_map_window(globalconf.connection, c->frame_window);
2137
+        client_restore_enterleave_events();
2134 2138
 
2135 2139
         c->isbanned = false;
2136 2140
 

Loading…
Cancel
Save