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>
This commit is contained in:
Uli Schlachter 2017-04-21 18:53:25 +02:00 committed by Daniel Hahler
parent ddf9689767
commit 7481a6e6b8
2 changed files with 4 additions and 4 deletions

View File

@ -52,8 +52,6 @@ banning_refresh(void)
globalconf.need_lazy_banning = false;
client_ignore_enterleave_events();
foreach(c, globalconf.clients)
if(client_isvisible(*c))
client_unban(*c);
@ -63,8 +61,6 @@ banning_refresh(void)
foreach(c, globalconf.clients)
if(!client_isvisible(*c))
client_ban(*c);
client_restore_enterleave_events();
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1059,7 +1059,9 @@ client_ban(client_t *c)
{
if(!c->isbanned)
{
client_ignore_enterleave_events();
xcb_unmap_window(globalconf.connection, c->frame_window);
client_restore_enterleave_events();
c->isbanned = true;
@ -2130,7 +2132,9 @@ client_unban(client_t *c)
lua_State *L = globalconf_get_lua_State();
if(c->isbanned)
{
client_ignore_enterleave_events();
xcb_map_window(globalconf.connection, c->frame_window);
client_restore_enterleave_events();
c->isbanned = false;