On Thu, Jul 25, 2013 at 08:25:52PM -0700, Daniel Ralston wrote:
> Hi all,
> 
> I've found a bug.
> 
> Repro steps:
>  1. Run 'tmux' in a terminal.
> 
>  2. In another terminal, create a grouped session, by running
>     'tmux new-session -t <name of first tmux session>'.
> 
>  3. Resize the second terminal so it is bigger than the first one.
> 
>  4. Kill the program running in the second (larger) terminal; e.g. by
>     hitting Ctrl-d if running a shell.
> 
> Instead of exiting gracefully, the server will segfault.
> Thanks!

I appreciate your bug reports, because they're easy for me to reproduce, but
the next time you submit one, I'd appreciate something like a corefile
backtrace.

I should probably really add something to the FAQ about this.

Your problem was because we were unconditionally calling recalculate() sizes
from destroying a session, and for a grouped instance, we were then trying
to access elements from a shared struct which had long since been destroyed.

Can you try the attached patch?  Again, I don't make use of grouped
sessions, so I'm looking to ensure I've not regressed anything.

-- 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 86e2054..cb1ab37 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -450,9 +450,10 @@ server_destroy_session(struct session *s)
 			notify_attached_session_changed(c);
 			session_update_activity(s_new);
 			server_redraw_client(c);
+
+			recalculate_sizes();
 		}
 	}
-	recalculate_sizes();
 }
 
 void
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to