diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-28 09:22:37 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-28 22:40:43 +1000 |
commit | 32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a (patch) | |
tree | 4460ec751c0d9bb32c837d3ecda0379ada0fffae /sway | |
parent | Merge pull request #2372 from RyanDwyer/fix-use-after-free-v2 (diff) | |
download | sway-32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a.tar.gz sway-32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a.tar.zst sway-32663b7b013e9c0fd37c1c86d6c26bc3156e1c3a.zip |
Handle out-of-fd situations gracefully for transaction and urgent timers
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/transaction.c | 9 | ||||
-rw-r--r-- | sway/input/seat.c | 10 |
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) { | |||
316 | // Set up a timer which the views must respond within | 316 | // Set up a timer which the views must respond within |
317 | transaction->timer = wl_event_loop_add_timer(server.wl_event_loop, | 317 | transaction->timer = wl_event_loop_add_timer(server.wl_event_loop, |
318 | handle_timeout, transaction); | 318 | handle_timeout, transaction); |
319 | wl_event_source_timer_update(transaction->timer, txn_timeout_ms); | 319 | if (transaction->timer) { |
320 | wl_event_source_timer_update(transaction->timer, txn_timeout_ms); | ||
321 | } else { | ||
322 | wlr_log(WLR_ERROR, "Unable to create transaction timer. " | ||
323 | "There might not be any available file descriptors. " | ||
324 | "Some imperfect frames might be rendered."); | ||
325 | handle_timeout(transaction); | ||
326 | } | ||
320 | } | 327 | } |
321 | 328 | ||
322 | // The debug tree shows the pending/live tree. Here is a good place to | 329 | // 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, | |||
696 | config->urgent_timeout > 0) { | 696 | config->urgent_timeout > 0) { |
697 | view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop, | 697 | view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop, |
698 | handle_urgent_timeout, view); | 698 | handle_urgent_timeout, view); |
699 | wl_event_source_timer_update(view->urgent_timer, | 699 | if (view->urgent_timer) { |
700 | config->urgent_timeout); | 700 | wl_event_source_timer_update(view->urgent_timer, |
701 | config->urgent_timeout); | ||
702 | } else { | ||
703 | wlr_log(WLR_ERROR, "Unable to create urgency timer. " | ||
704 | "There might not be any available file descriptors."); | ||
705 | handle_urgent_timeout(view); | ||
706 | } | ||
701 | } else { | 707 | } else { |
702 | view_set_urgent(view, false); | 708 | view_set_urgent(view, false); |
703 | } | 709 | } |