aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-07-28 09:05:28 -0400
committerLibravatar GitHub <noreply@github.com>2018-07-28 09:05:28 -0400
commite4b54ac16e52cea9fe7f8385e87033764d36522f (patch)
tree68a12cfe22d349eada6dba59cf6c5c4ef8ec8620 /sway
parentMerge pull request #2365 from RyanDwyer/fix-cmd-defer-crash (diff)
parentInclude errno.h (diff)
downloadsway-e4b54ac16e52cea9fe7f8385e87033764d36522f.tar.gz
sway-e4b54ac16e52cea9fe7f8385e87033764d36522f.tar.zst
sway-e4b54ac16e52cea9fe7f8385e87033764d36522f.zip
Merge pull request #2368 from RyanDwyer/handle-out-of-fds
Handle out-of-fd situations gracefully for transaction and urgent timers
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/transaction.c10
-rw-r--r--sway/input/seat.c11
2 files changed, 18 insertions, 3 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index ccda1963..7975366e 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -1,4 +1,5 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <errno.h>
2#include <stdbool.h> 3#include <stdbool.h>
3#include <stdlib.h> 4#include <stdlib.h>
4#include <string.h> 5#include <string.h>
@@ -316,7 +317,14 @@ static void transaction_commit(struct sway_transaction *transaction) {
316 // Set up a timer which the views must respond within 317 // Set up a timer which the views must respond within
317 transaction->timer = wl_event_loop_add_timer(server.wl_event_loop, 318 transaction->timer = wl_event_loop_add_timer(server.wl_event_loop,
318 handle_timeout, transaction); 319 handle_timeout, transaction);
319 wl_event_source_timer_update(transaction->timer, txn_timeout_ms); 320 if (transaction->timer) {
321 wl_event_source_timer_update(transaction->timer, txn_timeout_ms);
322 } else {
323 wlr_log(WLR_ERROR, "Unable to create transaction timer (%s). "
324 "Some imperfect frames might be rendered.",
325 strerror(errno));
326 handle_timeout(transaction);
327 }
320 } 328 }
321 329
322 // The debug tree shows the pending/live tree. Here is a good place to 330 // The debug tree shows the pending/live tree. Here is a good place to
diff --git a/sway/input/seat.c b/sway/input/seat.c
index e7b6e0c5..b783a84f 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -1,6 +1,7 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#define _POSIX_C_SOURCE 199309L 2#define _POSIX_C_SOURCE 199309L
3#include <assert.h> 3#include <assert.h>
4#include <errno.h>
4#ifdef __linux__ 5#ifdef __linux__
5#include <linux/input-event-codes.h> 6#include <linux/input-event-codes.h>
6#elif __FreeBSD__ 7#elif __FreeBSD__
@@ -696,8 +697,14 @@ void seat_set_focus_warp(struct sway_seat *seat,
696 config->urgent_timeout > 0) { 697 config->urgent_timeout > 0) {
697 view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop, 698 view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop,
698 handle_urgent_timeout, view); 699 handle_urgent_timeout, view);
699 wl_event_source_timer_update(view->urgent_timer, 700 if (view->urgent_timer) {
700 config->urgent_timeout); 701 wl_event_source_timer_update(view->urgent_timer,
702 config->urgent_timeout);
703 } else {
704 wlr_log(WLR_ERROR, "Unable to create urgency timer (%s)",
705 strerror(errno));
706 handle_urgent_timeout(view);
707 }
701 } else { 708 } else {
702 view_set_urgent(view, false); 709 view_set_urgent(view, false);
703 } 710 }