Skip to content

Commit

Permalink
fix: call ret:emit_signal("timeout") instead of args.callback (#3933)
Browse files Browse the repository at this point in the history
This ensures that the timer gets passed on the first call of callback.
fixes: #3904

Signed-off-by: aarondill <[email protected]>
  • Loading branch information
aarondill committed Aug 18, 2024
1 parent ad0290b commit 220ae79
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/gears/timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,11 @@ function timer.new(args)
end

if args.callback then
if args.call_now then
args.callback()
end
ret:connect_signal("timeout", args.callback)
end

if args.call_now then
ret:emit_signal("timeout")
end
if args.single_shot then
ret:connect_signal("timeout", function() ret:stop() end)
end
Expand Down

0 comments on commit 220ae79

Please sign in to comment.