From: Michael Stapelberg Date: Wed, 27 Jun 2012 15:48:22 +0000 (+0200) Subject: Bugfix: fix reload crashes in rare cases (Thanks Tucos) X-Git-Tag: 4.3~199^2^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6e9bbe67ce5f02ff6ac24889e5a215ee46247c32;p=i3%2Fi3 Bugfix: fix reload crashes in rare cases (Thanks Tucos) Depending on the memory layout, it could happen that bind->command was exchanged with something else while the parser still accessed it. Therefore, we now copy the command and let the parser use that copy. --- diff --git a/src/handlers.c b/src/handlers.c index 148d6337..cb76eb78 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -119,7 +119,9 @@ static void handle_key_press(xcb_key_press_event_t *event) { } } - struct CommandResult *command_output = parse_command(bind->command); + char *command_copy = sstrdup(bind->command); + struct CommandResult *command_output = parse_command(command_copy); + free(command_copy); if (command_output->needs_tree_render) tree_render();