Skip to content

Commit

Permalink
fix: wrap signal callback in protected_call
Browse files Browse the repository at this point in the history
  • Loading branch information
Aire-One committed Aug 6, 2022
1 parent b7bac1d commit f068a24
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/gears/object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {} }

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit f068a24

Please sign in to comment.