=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/cmd-unlink-window.c,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** src/usr.bin/tmux/Attic/cmd-unlink-window.c 2009/09/20 17:31:26 1.6 --- src/usr.bin/tmux/Attic/cmd-unlink-window.c 2009/10/10 10:02:48 1.7 *************** *** 1,4 **** ! /* $OpenBSD: cmd-unlink-window.c,v 1.6 2009/09/20 17:31:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-unlink-window.c,v 1.7 2009/10/10 10:02:48 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 42,57 **** { struct cmd_target_data *data = self->data; struct winlink *wl; ! struct session *s; if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) return (-1); ! if (!(data->chflags & CMD_CHFLAG('k')) && wl->window->references == 1) { ctx->error(ctx, "window is only linked to one session"); return (-1); } ! server_unlink_window(s, wl); recalculate_sizes(); --- 42,69 ---- { struct cmd_target_data *data = self->data; struct winlink *wl; ! struct window *w; ! struct session *s, *s2; ! struct session_group *sg; ! u_int references; if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) return (-1); + w = wl->window; ! sg = session_group_find(s); ! if (sg != NULL) { ! references = 0; ! TAILQ_FOREACH(s2, &sg->sessions, gentry) ! references++; ! } else ! references = 1; ! ! if (!(data->chflags & CMD_CHFLAG('k')) && w->references == references) { ctx->error(ctx, "window is only linked to one session"); return (-1); } ! server_unlink_window(s, wl); recalculate_sizes();