aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/keyboard.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-08 19:28:53 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-08 19:28:53 +1000
commit82423991a8512ab97fbc41d1e190e709c58bc346 (patch)
tree837e45f94240e02e2ab0f8f931227943e00819b3 /sway/input/keyboard.c
parentMerge pull request #2786 from swaywm/no-op-client-commands (diff)
downloadsway-82423991a8512ab97fbc41d1e190e709c58bc346.tar.gz
sway-82423991a8512ab97fbc41d1e190e709c58bc346.tar.zst
sway-82423991a8512ab97fbc41d1e190e709c58bc346.zip
Reload config using idle event
This patch makes it so when you run reload, the actual reloading is deferred to the next time the event loop becomes idle. This avoids several use-after-frees and removes the workarounds we have to avoid them. When you run reload, we validate the config before creating the idle event. This is so the reload command will still return an error if there are validation errors. To allow this, load_main_config has been adjusted so it doesn't apply the config if validating is true rather than applying it unconditionally. This also fixes a memory leak in the reload command where if the config failed to load, the bar_ids list would not be freed.
Diffstat (limited to 'sway/input/keyboard.c')
-rw-r--r--sway/input/keyboard.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 5fc8a806..0e14c036 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -278,9 +278,7 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
278 raw_modifiers, false, input_inhibited); 278 raw_modifiers, false, input_inhibited);
279 279
280 if (binding_pressed) { 280 if (binding_pressed) {
281 if ((binding_pressed->flags & BINDING_RELOAD) == 0) { 281 next_repeat_binding = binding_pressed;
282 next_repeat_binding = binding_pressed;
283 }
284 seat_execute_command(seat, binding_pressed); 282 seat_execute_command(seat, binding_pressed);
285 handled = true; 283 handled = true;
286 } 284 }