Let the found winlink determine the session used when handling the
'a' option. This fixes several problematic scenarios:
* Command from command line: curclient would be NULL, which would
crash the server.
* Specifying a window in another session: would have killed all the
windows in the current session (since none is equal to the winlink
found in the other session), and left the windows of the other
session untouched.
It seems to make sense to kill the "other windows" in the session
of the specified window, not always the "current" session.
---
trunk/cmd-kill-window.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/trunk/cmd-kill-window.c b/trunk/cmd-kill-window.c
index 9325324..abe7738 100644
--- a/trunk/cmd-kill-window.c
+++ b/trunk/cmd-kill-window.c
@@ -41,12 +41,13 @@ cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct winlink *wl, *wl2;
+ struct session *s;
- if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
+ if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
return (-1);
if (args_has(args, 'a')) {
- RB_FOREACH(wl2, winlinks, &ctx->curclient->session->windows) {
+ RB_FOREACH(wl2, winlinks, &s->windows) {
if (wl != wl2)
server_kill_window(wl2->window);
}
--
1.7.10.2
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users