Skip to content

Instantly share code, notes, and snippets.

@miaout17
Created August 15, 2011 16:35
Show Gist options
  • Save miaout17/1147142 to your computer and use it in GitHub Desktop.
Save miaout17/1147142 to your computer and use it in GitHub Desktop.
tmux-unbind-all-crash.patch
set-option -g prefix C-a
# If we perform "unbind-key a" within a keybind
# It will have very high probability to crash
bind-key u unbind-key -a
# Following code shows a general use case:
# * I want to unbind all keys in .tmux.conf, then bind everything by myself
# * I need a hotkey to reload my .tmux.conf script
# When I try to reload, tmux server crashes.
unbind-key -a
bind-key r source-file ~/.tmux.conf
Index: cmd-unbind-key.c
===================================================================
--- cmd-unbind-key.c (revision 2576)
+++ cmd-unbind-key.c (working copy)
@@ -59,9 +59,7 @@
if (args_has(args, 'a')) {
while (!SPLAY_EMPTY(&key_bindings)) {
bd = SPLAY_ROOT(&key_bindings);
- SPLAY_REMOVE(key_bindings, &key_bindings, bd);
- cmd_list_free(bd->cmdlist);
- xfree(bd);
+ key_bindings_remove(bd->key);
}
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment