notification: Prevent the timer to be started early in the constructor.

Otherwise the timer will be started before the preset is applied.
This commit is contained in:
Emmanuel Lepage Vallee 2019-07-15 02:12:20 -04:00
parent b9d19988b9
commit 84ae41422f
1 changed files with 5 additions and 1 deletions

View File

@ -439,7 +439,11 @@ end
function notification:reset_timeout(new_timeout)
if self.timer then self.timer:stop() end
self.timeout = new_timeout or self.timeout
-- Do not set `self.timeout` to `self.timeout` since that would create the
-- timer before the constructor ends.
if new_timeout and self.timer then
self.timeout = new_timeout or self.timeout
end
if self.timer and not self.timer.started then
self.timer:start()