From 32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 28 Jul 2018 09:22:37 +1000 Subject: Handle out-of-fd situations gracefully for transaction and urgent timers --- sway/desktop/transaction.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sway/desktop') diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index ccda1963..a9c9cb58 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -316,7 +316,14 @@ static void transaction_commit(struct sway_transaction *transaction) { // Set up a timer which the views must respond within transaction->timer = wl_event_loop_add_timer(server.wl_event_loop, handle_timeout, transaction); - wl_event_source_timer_update(transaction->timer, txn_timeout_ms); + if (transaction->timer) { + wl_event_source_timer_update(transaction->timer, txn_timeout_ms); + } else { + wlr_log(WLR_ERROR, "Unable to create transaction timer. " + "There might not be any available file descriptors. " + "Some imperfect frames might be rendered."); + handle_timeout(transaction); + } } // The debug tree shows the pending/live tree. Here is a good place to -- cgit v1.2.3 From d6daf10cad540f7581e9a325a041333d1113cae5 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 28 Jul 2018 10:00:04 +1000 Subject: Show errno description in log --- sway/desktop/transaction.c | 6 +++--- sway/input/seat.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index a9c9cb58..17e3f467 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -319,9 +319,9 @@ static void transaction_commit(struct sway_transaction *transaction) { if (transaction->timer) { wl_event_source_timer_update(transaction->timer, txn_timeout_ms); } else { - wlr_log(WLR_ERROR, "Unable to create transaction timer. " - "There might not be any available file descriptors. " - "Some imperfect frames might be rendered."); + wlr_log(WLR_ERROR, "Unable to create transaction timer (%s). " + "Some imperfect frames might be rendered.", + strerror(errno)); handle_timeout(transaction); } } diff --git a/sway/input/seat.c b/sway/input/seat.c index ab07c03c..ce2e0936 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -700,8 +700,8 @@ void seat_set_focus_warp(struct sway_seat *seat, wl_event_source_timer_update(view->urgent_timer, config->urgent_timeout); } else { - wlr_log(WLR_ERROR, "Unable to create urgency timer. " - "There might not be any available file descriptors."); + wlr_log(WLR_ERROR, "Unable to create urgency timer (%s)", + strerror(errno)); handle_urgent_timeout(view); } } else { -- cgit v1.2.3 From a4bcddcfdc67ef64edf3737342a99c4e41cae6d4 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 28 Jul 2018 10:24:04 +1000 Subject: Include errno.h --- sway/desktop/transaction.c | 1 + sway/input/seat.c | 1 + 2 files changed, 2 insertions(+) (limited to 'sway/desktop') diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 17e3f467..7975366e 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include #include #include #include diff --git a/sway/input/seat.c b/sway/input/seat.c index ce2e0936..b783a84f 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1,6 +1,7 @@ #define _XOPEN_SOURCE 700 #define _POSIX_C_SOURCE 199309L #include +#include #ifdef __linux__ #include #elif __FreeBSD__ -- cgit v1.2.3