diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-09-22 09:04:47 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-09-22 09:04:47 +0000 |
commit | aa1788fd739798fd39c7ce31be2aa7df5189ae14 (patch) | |
tree | 0dd8aeaffb576f81cfcc3990f20b6081859ca8e2 /usr.bin | |
parent | 8394d6b5511f9db51254612233cc9cb129559a17 (diff) |
Initialize alerts timer event where it is used, avoids crash with new windows.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/alerts.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/tmux/alerts.c b/usr.bin/tmux/alerts.c index 3feae5d0335..ad0f845dc5b 100644 --- a/usr.bin/tmux/alerts.c +++ b/usr.bin/tmux/alerts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alerts.c,v 1.27 2017/09/11 20:11:45 nicm Exp $ */ +/* $OpenBSD: alerts.c,v 1.28 2017/09/22 09:04:46 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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); |