summaryrefslogtreecommitdiffstats
path: root/alerts.c
diff options
context:
space:
mode:
authornicm <nicm>2017-09-22 09:04:46 +0000
committernicm <nicm>2017-09-22 09:04:46 +0000
commitd563aa7c7b45e6fbd87fb1072579583dbaba86bc (patch)
treeada7bc83a1b97fa39a54ba87373227afdae8490a /alerts.c
parentc86d83f835ec5c589dedb5b21f45df468fe7c875 (diff)
Initialize alerts timer event where it is used, avoids crash with new windows.
Diffstat (limited to 'alerts.c')
-rw-r--r--alerts.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/alerts.c b/alerts.c
index 27af3ee4..d90d0eb8 100644
--- a/alerts.c
+++ b/alerts.c
@@ -141,9 +141,11 @@ 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;
- if (event_initialized(&w->alerts_timer))
- event_del(&w->alerts_timer);
+ event_del(&w->alerts_timer);
timerclear(&tv);
tv.tv_sec = options_get_number(w->options, "monitor-silence");
@@ -158,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);