aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-28 09:22:37 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-28 22:40:43 +1000
commit32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a (patch)
tree4460ec751c0d9bb32c837d3ecda0379ada0fffae
parenta2164c666197e983b2059647e31fd93491893c43 (diff)
downloadsway-32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a.tar.xz
Handle out-of-fd situations gracefully for transaction and urgent timers
-rw-r--r--sway/desktop/transaction.c9
-rw-r--r--sway/input/seat.c10
2 files changed, 16 insertions, 3 deletions
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
diff --git a/sway/input/seat.c b/sway/input/seat.c
index e7b6e0c5..ab07c03c 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -696,8 +696,14 @@ void seat_set_focus_warp(struct sway_seat *seat,
config->urgent_timeout > 0) {
view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop,
handle_urgent_timeout, view);
- wl_event_source_timer_update(view->urgent_timer,
- config->urgent_timeout);
+ if (view->urgent_timer) {
+ 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.");
+ handle_urgent_timeout(view);
+ }
} else {
view_set_urgent(view, false);
}