summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-09-22 09:04:46 +0000
committernicm <nicm@openbsd.org>2017-09-22 09:04:46 +0000
commit51ae4248b54fafa4a955b414344d50a86dcf61ee (patch)
treea7a7afba5e6daf9c477325e83be162bcc1ce7783
parentMove the powering down of all codecs into azalia_halt_corb() after the (diff)
downloadwireguard-openbsd-51ae4248b54fafa4a955b414344d50a86dcf61ee.tar.xz
wireguard-openbsd-51ae4248b54fafa4a955b414344d50a86dcf61ee.zip
Initialize alerts timer event where it is used, avoids crash with new windows.
-rw-r--r--usr.bin/tmux/alerts.c11
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);