aboutsummaryrefslogtreecommitdiff
path: root/cmd-join-pane.c
diff options
context:
space:
mode:
authorMicah Cowan <micah@micah.cowan.name>2010-04-09 07:09:37 +0000
committerMicah Cowan <micah@micah.cowan.name>2010-04-09 07:09:37 +0000
commitb2e752b3842ffeb21cd4a8b80bee673d43e88695 (patch)
tree1cd652536ffe9858060b37ab6c5f172067facf6b /cmd-join-pane.c
parent08632b4f0aea44a21bf5b0755197e076277bb437 (diff)
downloadrtmux-b2e752b3842ffeb21cd4a8b80bee673d43e88695.tar.gz
rtmux-b2e752b3842ffeb21cd4a8b80bee673d43e88695.tar.bz2
rtmux-b2e752b3842ffeb21cd4a8b80bee673d43e88695.zip
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: ----------------------------------------------------------------------
Diffstat (limited to 'cmd-join-pane.c')
-rw-r--r--cmd-join-pane.c7
1 files 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 <nicm@users.sourceforge.net>
@@ -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);