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.
This commit is contained in:
Michael Stapelberg 2012-06-27 17:48:22 +02:00
parent 28d453a276
commit 6e9bbe67ce
1 changed files with 3 additions and 1 deletions

View File

@ -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) if (command_output->needs_tree_render)
tree_render(); tree_render();