From f068a24bdfb09b44a8e1dfe11511ab223d854455 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 6 Aug 2022 16:41:24 +0200 Subject: [PATCH] fix: wrap signal callback in protected_call Fixes #3667 --- lib/gears/object.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/gears/object.lua b/lib/gears/object.lua index b9b381c5c6..928a732427 100644 --- a/lib/gears/object.lua +++ b/lib/gears/object.lua @@ -14,6 +14,7 @@ local pairs = pairs local type = type local error = error local properties = require("gears.object.properties") +local protected_call = require("gears.protected_call") local object = { properties = properties, mt = {} } @@ -132,13 +133,13 @@ end function object:emit_signal(name, ...) local sig = find_signal(self, name) for func in pairs(sig.strong) do - func(self, ...) + protected_call(func, self, ...) end for func in pairs(sig.weak) do - func(self, ...) + protected_call(func, self, ...) end for _, func in ipairs(self._global_receivers) do - func(name, self, ...) + protected_call(func, name, self, ...) end end @@ -158,7 +159,7 @@ function object._setup_class_signals(t, args) assert(name) for _, func in pairs(conns[name] or {}) do if condition(...) then return end - func(...) + protected_call(func, ...) end end end