commit 8e60efe0bf771120818b675d54c87b091c68fd70
parent bbfe13a24893bac6a5c41ac39115288d1d6e025f
Author: Brian Ashworth <bosrsf04@gmail.com>
Date: Sun, 3 Feb 2019 14:00:37 -0500
Merge pull request #3563 from vilhalmer/fix-wildcard-seat-constrain-crashes-during-reconfig
Fix wildcard seat constrain crashes during reconfig
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/sway/config.c b/sway/config.c
@@ -141,6 +141,11 @@ static void destroy_removed_seats(struct sway_config *old_config,
int i;
for (i = 0; i < old_config->seat_configs->length; i++) {
seat_config = old_config->seat_configs->items[i];
+ // Skip the wildcard seat config, it won't have a matching real seat.
+ if (strcmp(seat_config->name, "*") == 0) {
+ continue;
+ }
+
/* Also destroy seats that aren't present in new config */
if (new_config && list_seq_find(new_config->seat_configs,
seat_name_cmp, seat_config->name) < 0) {
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
@@ -1459,7 +1459,11 @@ void handle_pointer_constraint(struct wl_listener *listener, void *data) {
void sway_cursor_constrain(struct sway_cursor *cursor,
struct wlr_pointer_constraint_v1 *constraint) {
struct seat_config *config = seat_get_config(cursor->seat);
- if (config->allow_constrain == CONSTRAIN_DISABLE) {
+ if (!config) {
+ config = seat_get_config_by_name("*");
+ }
+
+ if (!config || config->allow_constrain == CONSTRAIN_DISABLE) {
return;
}