fix: wrap signal callback in protected_call

Fixes #3667
This commit is contained in:
Aire-One 2022-08-06 16:41:24 +02:00
parent b7bac1dc76
commit f068a24bdf
1 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,7 @@ local pairs = pairs
local type = type local type = type
local error = error local error = error
local properties = require("gears.object.properties") local properties = require("gears.object.properties")
local protected_call = require("gears.protected_call")
local object = { properties = properties, mt = {} } local object = { properties = properties, mt = {} }
@ -132,13 +133,13 @@ end
function object:emit_signal(name, ...) function object:emit_signal(name, ...)
local sig = find_signal(self, name) local sig = find_signal(self, name)
for func in pairs(sig.strong) do for func in pairs(sig.strong) do
func(self, ...) protected_call(func, self, ...)
end end
for func in pairs(sig.weak) do for func in pairs(sig.weak) do
func(self, ...) protected_call(func, self, ...)
end end
for _, func in ipairs(self._global_receivers) do for _, func in ipairs(self._global_receivers) do
func(name, self, ...) protected_call(func, name, self, ...)
end end
end end
@ -158,7 +159,7 @@ function object._setup_class_signals(t, args)
assert(name) assert(name)
for _, func in pairs(conns[name] or {}) do for _, func in pairs(conns[name] or {}) do
if condition(...) then return end if condition(...) then return end
func(...) protected_call(func, ...)
end end
end end
end end