diff options
-rw-r--r-- | sway/desktop/transaction.c | 10 | ||||
-rw-r--r-- | sway/input/seat.c | 11 | ||||
-rw-r--r-- | sway/tree/container.c | 7 |
3 files changed, 23 insertions, 5 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index ccda1963..7975366e 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -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 diff --git a/sway/input/seat.c b/sway/input/seat.c index 18d5591d..53a92989 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 <assert.h> +#include <errno.h> #ifdef __linux__ #include <linux/input-event-codes.h> #elif __FreeBSD__ @@ -701,8 +702,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); } diff --git a/sway/tree/container.c b/sway/tree/container.c index 2332d81f..b7442002 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -142,8 +142,6 @@ struct sway_container *container_create(enum sway_container_type type) { static void container_workspace_free(struct sway_workspace *ws) { list_foreach(ws->output_priority, free); list_free(ws->output_priority); - ws->floating->destroying = true; - container_free(ws->floating); free(ws); } @@ -196,6 +194,9 @@ void container_free(struct sway_container *cont) { free(cont); } +static struct sway_container *container_destroy_noreaping( + struct sway_container *con); + static struct sway_container *container_workspace_destroy( struct sway_container *workspace) { if (!sway_assert(workspace, "cannot destroy null workspace")) { @@ -240,6 +241,8 @@ static struct sway_container *container_workspace_destroy( } } + container_destroy_noreaping(workspace->sway_workspace->floating); + return output; } |