fix: call ret:emit_signal("timeout") instead of args.callback (#3933)
This ensures that the timer gets passed on the first call of callback. fixes: #3904 Signed-off-by: aarondill <aaronsacks2006@gmail.com>
This commit is contained in:
parent
ad0290bc1a
commit
220ae797e9
|
@ -205,12 +205,11 @@ function timer.new(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.callback then
|
if args.callback then
|
||||||
if args.call_now then
|
|
||||||
args.callback()
|
|
||||||
end
|
|
||||||
ret:connect_signal("timeout", args.callback)
|
ret:connect_signal("timeout", args.callback)
|
||||||
end
|
end
|
||||||
|
if args.call_now then
|
||||||
|
ret:emit_signal("timeout")
|
||||||
|
end
|
||||||
if args.single_shot then
|
if args.single_shot then
|
||||||
ret:connect_signal("timeout", function() ret:stop() end)
|
ret:connect_signal("timeout", function() ret:stop() end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue