summaryrefslogtreecommitdiffstats
path: root/alerts.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-28 19:10:48 +0000
committernicm <nicm>2017-04-28 19:10:48 +0000
commit92053cb4924e5c772ba52aca83437cf3da0a75fd (patch)
treed45f5365f5151c322f64a35a253df9a8cbecd5e3 /alerts.c
parent54e2205e545d72d8d9ccaadfd4d1212bafb2f41b (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 'alerts.c')
-rw-r--r--alerts.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/alerts.c b/alerts.c
index 708a24e2..f4a3520c 100644
--- a/alerts.c
+++ b/alerts.c
@@ -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;
+ }
}
}