bugfix: copy binding before run

Copy the binding struct before running it and use this copy to emit the
binding event.

This fixes a crash when the command `reload` is used in a binding when
the binding event is emitted.
This commit is contained in:
Tony Crisci
2014-11-10 00:04:47 -05:00
committed by Michael Stapelberg
parent 0125530409
commit bb1f857b00
4 changed files with 83 additions and 6 deletions

View File

@ -147,9 +147,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
while (!TAILQ_EMPTY(bindings)) {
bind = TAILQ_FIRST(bindings);
TAILQ_REMOVE(bindings, bind, bindings);
FREE(bind->translated_to);
FREE(bind->command);
FREE(bind);
binding_free(bind);
}
FREE(bindings);
SLIST_REMOVE(&modes, mode, Mode, modes);