From 57e05cda1c05eeb793973ff214713bf7d2ad48c5 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 27 Dec 2018 07:05:57 +0100 Subject: [PATCH] awful.layout: move arrange locks This fixes a deadlock when some arrange signal handler itself changes a property like `border_width`: function border1(c) c.border_width = 50 end client.connect_signal("property::border_width", border1) awful.screen.connect_for_each_screen(function(s) local border_for_s = function(s_) local clients = awful.client.visible(s_) for _, c in pairs(clients) do c.border_width = 2 end end screen[s]:connect_signal("arrange", border_for_s) end) It might be better to have some counter there instead and emit a warning if this happens (while allowing for e.g. 3 recursions). This would allow handlers to break out of this themselves (by not insisting to change the property). --- lib/awful/layout/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 7ef4d5f5e..26d8855eb 100644 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -232,10 +232,11 @@ function layout.arrange(screen) c:geometry(g) end end) + screen:emit_signal("arrange") + + -- Release locks after signal to avoid deadly lock. arrange_lock = false delayed_arrange[screen] = nil - - screen:emit_signal("arrange") end) end