diff options
author | wm4 <wm4@nowhere> | 2013-07-08 19:44:46 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-08 20:37:11 +0200 |
commit | 0bb41524f0a9ed89559b50bd7407de9d8b8aee40 (patch) | |
tree | cce7a7491279a098763477450267dbbf7f6e12a9 | |
parent | 846f46ec1df39fb65490a90826039eb709261da0 (diff) | |
download | mpv-0bb41524f0a9ed89559b50bd7407de9d8b8aee40.tar.bz2 mpv-0bb41524f0a9ed89559b50bd7407de9d8b8aee40.tar.xz |
input: actually copy sub commands
This was missing from the previous commit. It worked by luck, because
the sub-commands weren't freed either (as long as the original command
was around), but this is proper.
Also, set the original string for command lists (needed for input-test
only).
-rw-r--r-- | core/input/input.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/input/input.c b/core/input/input.c index 73ac5bc698..ce7b868c02 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -1034,6 +1034,7 @@ mp_cmd_t *mp_input_parse_cmd(bstr str, const char *loc) *list = (struct mp_cmd) { .id = MP_CMD_COMMAND_LIST, .name = "list", + .original = bstrdup(list, str), }; list->args[0].v.p = cmd; while (cmd) { @@ -1775,6 +1776,17 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd) ret->args[i].v.s = talloc_strdup(ret, cmd->args[i].v.s); } + if (cmd->id == MP_CMD_COMMAND_LIST) { + bool first = true; + for (struct mp_cmd *sub = cmd->args[0].v.p; sub; sub = sub->queue_next) { + sub = mp_cmd_clone(sub); + talloc_steal(cmd, sub); + if (first) + cmd->args[0].v.p = sub; + first = false; + } + } + return ret; } |