aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2019-01-18 19:32:06 +0100
committerLibravatar emersion <contact@emersion.fr>2019-01-19 08:29:46 +0100
commit3b7a7462a2fe3d71a321860ac111b60b76bf44dd (patch)
tree50476a37fde83f582cb96ef5ed016a7bf9369eb7 /sway/input/cursor.c
parentMerge pull request #3464 from emersion/meson-check-wlroots-xwayland (diff)
downloadsway-3b7a7462a2fe3d71a321860ac111b60b76bf44dd.tar.gz
sway-3b7a7462a2fe3d71a321860ac111b60b76bf44dd.tar.zst
sway-3b7a7462a2fe3d71a321860ac111b60b76bf44dd.zip
Fix crash in cursor_rebase with multiple screens
Designing the output configuration sequence without invalid state is tricky. We have one function, apply_output_config, that takes an output and (besides other things) performs a modeset and inserts the output in the output layout. The modeset can fail, in which case we don't want the output to be enabled. We also have an output_enable function, which calls output_apply_config and also configures the output's workspace and inserts it in the root container. Now, we have two choices. Either we configure the output before it's been inserted in the root container and then, if the modeset was successful, we insert it and create the workspace. The main issue with this approach is that configuring the output triggers a handful of signals, namely wlr_output.mode and wlr_output_layout.change. In those event handlers, we need to make sure to ignore these outputs in the process of being configured. Either we first insert the output, create the workspace and then try to configure it. It means we need to undo everything if the modeset fails. The main issue with this solution is that it enables and disables the output very quickly, creates a workspace and immediately destroys it, and maybe moves views back and forth (see output_evacuate). I've tried to make it so an output isn't enabled then immediately disabled. We already have code for ignoring outputs when the output is being destructed. Fixes https://github.com/swaywm/sway/issues/3462
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 5eb44412..35683f06 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -83,8 +83,8 @@ struct sway_node *node_at_coords(
83 return NULL; 83 return NULL;
84 } 84 }
85 struct sway_output *output = wlr_output->data; 85 struct sway_output *output = wlr_output->data;
86 if (!output) { 86 if (!output || !output->configured) {
87 // output is being destroyed 87 // output is being destroyed or is being configured
88 return NULL; 88 return NULL;
89 } 89 }
90 double ox = lx, oy = ly; 90 double ox = lx, oy = ly;