Merge pull request #2368 from RyanDwyer/handle-out-of-fds

Handle out-of-fd situations gracefully for transaction and urgent timers
master
Drew DeVault 7 years ago committed by GitHub
commit e4b54ac16e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
#define _POSIX_C_SOURCE 200809L
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@ -316,7 +317,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 (%s). "
"Some imperfect frames might be rendered.",
strerror(errno));
handle_timeout(transaction);
}
}
// The debug tree shows the pending/live tree. Here is a good place to

@ -1,6 +1,7 @@
#define _XOPEN_SOURCE 700
#define _POSIX_C_SOURCE 199309L
#include <assert.h>
#include <errno.h>
#ifdef __linux__
#include <linux/input-event-codes.h>
#elif __FreeBSD__
@ -696,8 +697,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 (%s)",
strerror(errno));
handle_urgent_timeout(view);
}
} else {
view_set_urgent(view, false);
}

Loading…
Cancel
Save