diff options
author | Thomas Adam <thomas@xteddy.org> | 2014-10-29 12:50:05 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2014-10-29 12:51:21 +0000 |
commit | 35ffd093d724053046ae49984af0beb0530e5560 (patch) | |
tree | d5b89a213621dc56b852fc7eb8a1daba12046830 /session.c | |
parent | 201036ad80f2e51f7238db2adf05914a4a4f5819 (diff) | |
parent | 10a9440055ccdda5788965bcb048207eab2a0548 (diff) |
Merge branch 'obsd-master'
Conflicts:
Makefile
cmd-link-window.c
cmd-unlink-window.c
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -126,7 +126,7 @@ session_create(const char *name, int argc, char **argv, const char *path, s->name = NULL; do { s->id = next_session_id++; - free (s->name); + free(s->name); xasprintf(&s->name, "%u", s->id); } while (RB_FIND(sessions, &sessions, s) != NULL); } @@ -491,6 +491,19 @@ session_group_remove(struct session *s) } } +/* Count number of sessions in session group. */ +u_int +session_group_count(struct session_group *sg) +{ + struct session *s; + u_int n; + + n = 0; + TAILQ_FOREACH(s, &sg->sessions, gentry) + n++; + return (n); +} + /* Synchronize a session to its session group. */ void session_group_synchronize_to(struct session *s) @@ -578,8 +591,9 @@ session_group_synchronize1(struct session *target, struct session *s) /* Then free the old winlinks list. */ while (!RB_EMPTY(&old_windows)) { wl = RB_ROOT(&old_windows); - if (winlink_find_by_window_id(&s->windows, wl->window->id) == NULL) - notify_window_unlinked(s, wl->window); + wl2 = winlink_find_by_window_id(&s->windows, wl->window->id); + if (wl2 == NULL) + notify_window_unlinked(s, wl->window); winlink_remove(&old_windows, wl); } } |