From b2e752b3842ffeb21cd4a8b80bee673d43e88695 Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Fri, 9 Apr 2010 07:09:37 +0000 Subject: [PATCH] Don't try to use a window-link that may have been freed. In the case where a join-pane is performed from within a grouped session, and the source pane had no siblings in the window (causing the window to be destroyed), there was an invalid access of the destination window link (which had been destroyed as part of the group session's resynchronization with the original session, due to killing the now-empty source window). CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: cmd-join-pane.c CVS: ---------------------------------------------------------------------- --- cmd-join-pane.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd-join-pane.c b/cmd-join-pane.c index 3ea012b3..15fdd765 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -1,4 +1,4 @@ -/* $Id: cmd-join-pane.c,v 1.3 2010-04-06 21:59:59 nicm Exp $ */ +/* $Id: cmd-join-pane.c,v 1.4 2010-04-09 07:09:37 micahcowan Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -150,13 +150,14 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx) struct winlink *src_wl, *dst_wl; struct window *src_w, *dst_w; struct window_pane *src_wp, *dst_wp; - int size; + int size, dst_idx; enum layout_type type; struct layout_cell *lc; if ((dst_wl = cmd_find_pane(ctx, data->dst, &dst_s, &dst_wp)) == NULL) return (-1); dst_w = dst_wl->window; + dst_idx = dst_wl->idx; if ((src_wl = cmd_find_pane(ctx, data->src, NULL, &src_wp)) == NULL) return (-1); @@ -209,7 +210,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx) if (!data->flag_detached) { window_set_active_pane(dst_w, src_wp); - session_select(dst_s, dst_wl->idx); + session_select(dst_s, dst_idx); server_redraw_session(dst_s); } else server_status_session(dst_s);