Initialize alerts timer event where it is used, avoids crash with new windows.

This commit is contained in:
nicm 2017-09-22 09:04:46 +00:00 committed by Nicholas Marriott
parent a8b84b7cfa
commit 71ec616e4d

View File

@ -141,6 +141,9 @@ alerts_reset(struct window *w)
{
struct timeval tv;
if (!event_initialized(&w->alerts_timer))
evtimer_set(&w->alerts_timer, alerts_timer, w);
w->flags &= ~WINDOW_SILENCE;
event_del(&w->alerts_timer);
@ -157,9 +160,6 @@ alerts_queue(struct window *w, int flags)
{
alerts_reset(w);
if (!event_initialized(&w->alerts_timer))
evtimer_set(&w->alerts_timer, alerts_timer, w);
if ((w->flags & flags) != flags) {
w->flags |= flags;
log_debug("@%u alerts flags added %#x", w->id, flags);