summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/alerts.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-04-28 19:10:49 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-04-28 19:10:49 +0000
commit59823b7db067e4a18148b871232df15ee9fb6096 (patch)
tree740c113da9c1f4a00d06675f65b012d79ef2f9ec /usr.bin/tmux/alerts.c
parent6e1470f685304966c185be1a7c6eb7d694c1bd1c (diff)
Do not put the window on the alerts queue and add a reference unless the
alert is enabled and we are actually going to add the alerts event.
Diffstat (limited to 'usr.bin/tmux/alerts.c')
-rw-r--r--usr.bin/tmux/alerts.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/usr.bin/tmux/alerts.c b/usr.bin/tmux/alerts.c
index 902cb45bfac..da4bec99617 100644
--- a/usr.bin/tmux/alerts.c
+++ b/usr.bin/tmux/alerts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alerts.c,v 1.17 2017/04/21 14:09:44 nicm Exp $ */
+/* $OpenBSD: alerts.c,v 1.18 2017/04/28 19:10:48 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -144,16 +144,18 @@ alerts_queue(struct window *w, int flags)
log_debug("@%u alerts flags added %#x", w->id, flags);
}
- if (!w->alerts_queued) {
- w->alerts_queued = 1;
- TAILQ_INSERT_TAIL(&alerts_list, w, alerts_entry);
- w->references++;
- }
+ if (alerts_enabled(w, flags)) {
+ if (!w->alerts_queued) {
+ w->alerts_queued = 1;
+ TAILQ_INSERT_TAIL(&alerts_list, w, alerts_entry);
+ w->references++;
+ }
- if (!alerts_fired && alerts_enabled(w, flags)) {
- log_debug("alerts check queued (by @%u)", w->id);
- event_once(-1, EV_TIMEOUT, alerts_callback, NULL, NULL);
- alerts_fired = 1;
+ if (!alerts_fired) {
+ log_debug("alerts check queued (by @%u)", w->id);
+ event_once(-1, EV_TIMEOUT, alerts_callback, NULL, NULL);
+ alerts_fired = 1;
+ }
}
}