diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-10-22 14:01:12 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-10-22 14:01:12 +0100 |
commit | 8c3981366574f5c6496985e0127ca817f3d70037 (patch) | |
tree | 98ebbee2088ac29bc7e1cf8d26699b02c1c2da42 /cmd-find.c | |
parent | 6bc3902f5d1188ea457907373011b7dd912e389c (diff) | |
parent | 3ebcf25149d75977ea97e9d4f786e0508d1a0d5e (diff) | |
download | rtmux-8c3981366574f5c6496985e0127ca817f3d70037.tar.gz rtmux-8c3981366574f5c6496985e0127ca817f3d70037.tar.bz2 rtmux-8c3981366574f5c6496985e0127ca817f3d70037.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-find.c')
-rw-r--r-- | cmd-find.c | 33 |
1 files changed, 22 insertions, 11 deletions
@@ -254,24 +254,35 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs) wp = NULL; /* Not running in a pane. We know nothing. Find the best session. */ - if (wp == NULL) { - fs->s = cmd_find_best_session(NULL, 0, fs->flags); - if (fs->s == NULL) - return (-1); - fs->wl = fs->s->curw; - fs->idx = fs->wl->idx; - fs->w = fs->wl->window; - fs->wp = fs->w->active; - return (0); - } + if (wp == NULL) + goto unknown_pane; /* We now know the window and pane. */ fs->w = wp->window; fs->wp = wp; /* Find the best session and winlink. */ - if (cmd_find_best_session_with_window(fs) != 0) + if (cmd_find_best_session_with_window(fs) != 0) { + if (wp != NULL) { + /* + * The window may have been destroyed but the pane + * still on all_window_panes due to something else + * holding a reference. + */ + goto unknown_pane; + } return (-1); + } + return (0); + +unknown_pane: + fs->s = cmd_find_best_session(NULL, 0, fs->flags); + if (fs->s == NULL) + return (-1); + fs->wl = fs->s->curw; + fs->idx = fs->wl->idx; + fs->w = fs->wl->window; + fs->wp = fs->w->active; return (0); } |