You're right. This is cos windows can now stick around w/o having any
panes or winlinks. This is the fix:

Index: names.c
===================================================================
--- names.c     (revision 2860)
+++ names.c     (working copy)
@@ -50,6 +50,9 @@
        struct window   *w = data;
        char            *name, *wname;
 
+       if (w->active == NULL)
+               return;
+
        if (!options_get_number(&w->options, "automatic-rename")) {
                if (event_initialized(&w->name_timer))
                        event_del(&w->name_timer);
Index: tmux.h
===================================================================
--- tmux.h      (revision 2860)
+++ tmux.h      (working copy)
@@ -2086,6 +2086,7 @@
 struct window_pane *window_pane_find_left(struct window_pane *);
 struct window_pane *window_pane_find_right(struct window_pane *);
 void            window_set_name(struct window *, const char *);
+void            window_remove_ref(struct window *);
 void            winlink_clear_flags(struct winlink *);
 void            window_mode_attrs(struct grid_cell *, struct options *);
 
Index: window.c
===================================================================
--- window.c    (revision 2860)
+++ window.c    (working copy)
@@ -179,13 +179,8 @@
        free(wl->status_text);
        free(wl);
 
-       if (w != NULL) {
-               if (w->references == 0)
-                       fatal("bad reference count");
-               w->references--;
-               if (w->references == 0)
-                       window_destroy(w);
-       }
+       if (w != NULL)
+               window_remove_ref(w);
 }
 
 struct winlink *
@@ -360,6 +355,16 @@
 }
 
 void
+window_remove_ref(struct window *w)
+{
+       if (w->references == 0)
+               fatal("bad reference count");
+       w->references--;
+       if (w->references == 0)
+               window_destroy(w);
+}
+
+void
 window_set_name(struct window *w, const char *new_name)
 {
        free(w->name);
Index: notify.c
===================================================================
--- notify.c    (revision 2860)
+++ notify.c    (working copy)
@@ -124,7 +124,8 @@
                if (ne->session != NULL)
                        ne->session->references--;
                if (ne->window != NULL)
-                       ne->window->references--;
+                       window_remove_ref(ne->window);
+
                TAILQ_REMOVE(&notify_queue, ne, entry);
                free(ne);
        }



On Thu, Aug 16, 2012 at 04:06:30PM +0200, Michael Scholz wrote:
> After updating tmux-1.7 to revision 2860 join-pane doesn't work any 
> longer.  One can reproduce it (without any ~/.tmux.conf file) with
> 
> % tmux-1.7 new \; neww -d \; joinp -s 1 -t 0
> [lost server]
> 
> and tmux-1.7 dumps core.
> 
> % gdb -q tmux-1.7 tmux-1.7.core
> Core was generated by `tmux-1.7'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /lib/libutil.so.9...done.
> Loaded symbols for /lib/libutil.so.9
> Reading symbols from /lib/libncurses.so.8...done.
> Loaded symbols for /lib/libncurses.so.8
> Reading symbols from /usr/local/lib/libevent-1.4.so.4...done.
> Loaded symbols for /usr/local/lib/libevent-1.4.so.4
> Reading symbols from /lib/libc.so.7...done.
> Loaded symbols for /lib/libc.so.7
> Reading symbols from /libexec/ld-elf.so.1...done.
> Loaded symbols for /libexec/ld-elf.so.1
> #0  0x00000000004306bf in window_name_callback (fd=-1, events=1,
>      data=0x8014173c0) at /usr/opt/cvs/tmux/trunk/names.c:60
> 60            if (w->active->screen != &w->active->base)
> (gdb) bt
> #0  0x00000000004306bf in window_name_callback (fd=-1, events=1,
>      data=0x8014173c0) at /usr/opt/cvs/tmux/trunk/names.c:60
> #1  0x00007fffffffc8a0 in ?? ()
> Current language:  auto; currently minimal
> (gdb) q
> 
> % uname -a
> FreeBSD pumpkin.fth-devel.net 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 
> r239174: Fri Aug 10 15:06:57 CEST 2012     
> r...@pumpkin.fth-devel.net:/usr/obj/usr/src/sys/PUMPKIN  amd64
> 
> % cd /usr/opt/cvs/tmux && svn info
> Path: .
> Working Copy Root Path: /usr/opt/cvs/tmux
> URL: https://tmux.svn.sourceforge.net/svnroot/tmux
> Repository Root: https://tmux.svn.sourceforge.net/svnroot/tmux
> Repository UUID: 303bd1e2-03bb-47f1-b221-2a0928954661
> Revision: 2860
> Node Kind: directory
> Schedule: normal
> Last Changed Author: nicm
> Last Changed Rev: 2860
> Last Changed Date: 2012-08-14 11:38:34 +0200 (Tue, 14 Aug 2012)
> 
> Mike
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to