On Sat, Jun 29, 2013 at 07:08:17AM -0700, Daniel Ralston wrote:
> On Sat, Jun 22, 2013 at 11:21 AM, Thomas Adam <tho...@xteddy.org> wrote:
>
> > On Fri, Jun 21, 2013 at 08:10:17PM -0700, Daniel Ralston wrote:
> > > Hi all,
> > >
> > > Bug Summary:
> > > When renumber-windows is set, killing a bunch of windows created in
> > another
> > > grouped session will make the server die unexpectedly.
> > >
> > > Repro Steps:
> > >
> > > - In .tmux.conf: *set -g renumber-windows on*
> > > - Open two terminals.
> > > - In one terminal, run *tmux, *and create a bunch of new windows ("C-b
> > c")
> > > - In the other terminal, run *tmux new-session -t *<name of other tmux
> > > session, e.g. 0>
> > > - In the second tmux client/session, kill a bunch of windows.(Created in
> > > the first client/session) ("C-b x")
> > >
> > > After killing a few, the server should die, killing both clients and
> > > displaying [Lost server] in both terminals.
> >
> > Does the attached help any? I'm afraid I've not a lot of time to look in
> > to
> > this, and I've not tested the patch either. I'm just supposing it'll do
> > the
> > right thing. ;P
> >
>
> I gave it a try, and it doesn't look like that patch is the magic ticket.
> Thanks, though!
I'm not surprised. Here's something which should work now that I've
bothered to test this myself. Let me know if it definitely works for you,
since I rarely make use of synchronised sessions.
-- Thomas Adam
--
"Deep in my heart I wish I was wrong. But deep in my heart I know I am
not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)
diff --git a/server-fn.c b/server-fn.c
index 7ef6413..c9e3a7f 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -262,8 +262,9 @@ server_lock_client(struct client *c)
void
server_kill_window(struct window *w)
{
- struct session *s, *next_s;
- struct winlink *wl;
+ struct session *s, *next_s, *target_s;
+ struct session_group *sg;
+ struct winlink *wl;
next_s = RB_MIN(sessions, &sessions);
while (next_s != NULL) {
@@ -280,8 +281,14 @@ server_kill_window(struct window *w)
server_redraw_session_group(s);
}
- if (options_get_number(&s->options, "renumber-windows"))
- session_renumber_windows(s);
+ if (options_get_number(&s->options, "renumber-windows")) {
+ if ((sg = session_group_find(s)) != NULL) {
+ TAILQ_FOREACH(target_s, &sg->sessions, gentry) {
+ session_renumber_windows(target_s);
+ }
+ } else
+ session_renumber_windows(s);
+ }
}
recalculate_sizes();
}
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users