mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
Handle out-of-fd situations gracefully for transaction and urgent timers
This commit is contained in:
parent
a2164c6661
commit
32663b7b01
2 changed files with 16 additions and 3 deletions
|
@ -316,7 +316,14 @@ static void transaction_commit(struct sway_transaction *transaction) {
|
||||||
// Set up a timer which the views must respond within
|
// Set up a timer which the views must respond within
|
||||||
transaction->timer = wl_event_loop_add_timer(server.wl_event_loop,
|
transaction->timer = wl_event_loop_add_timer(server.wl_event_loop,
|
||||||
handle_timeout, transaction);
|
handle_timeout, transaction);
|
||||||
|
if (transaction->timer) {
|
||||||
wl_event_source_timer_update(transaction->timer, txn_timeout_ms);
|
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
|
// The debug tree shows the pending/live tree. Here is a good place to
|
||||||
|
|
|
@ -696,8 +696,14 @@ void seat_set_focus_warp(struct sway_seat *seat,
|
||||||
config->urgent_timeout > 0) {
|
config->urgent_timeout > 0) {
|
||||||
view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop,
|
view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop,
|
||||||
handle_urgent_timeout, view);
|
handle_urgent_timeout, view);
|
||||||
|
if (view->urgent_timer) {
|
||||||
wl_event_source_timer_update(view->urgent_timer,
|
wl_event_source_timer_update(view->urgent_timer,
|
||||||
config->urgent_timeout);
|
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 {
|
} else {
|
||||||
view_set_urgent(view, false);
|
view_set_urgent(view, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue