[BACK]Return to window.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/window.c between version 1.191 and 1.192

version 1.191, 2017/04/28 19:12:15 version 1.192, 2017/04/28 19:13:55
Line 186 
Line 186 
 {  {
         if (wl->window != NULL) {          if (wl->window != NULL) {
                 TAILQ_REMOVE(&wl->window->winlinks, wl, wentry);                  TAILQ_REMOVE(&wl->window->winlinks, wl, wentry);
                 window_remove_ref(wl->window);                  window_remove_ref(wl->window, __func__);
         }          }
         TAILQ_INSERT_TAIL(&w->winlinks, wl, wentry);          TAILQ_INSERT_TAIL(&w->winlinks, wl, wentry);
         wl->window = w;          wl->window = w;
         w->references++;          window_add_ref(w, __func__);
 }  }
   
 void  void
Line 200 
Line 200 
   
         if (w != NULL) {          if (w != NULL) {
                 TAILQ_REMOVE(&w->winlinks, wl, wentry);                  TAILQ_REMOVE(&w->winlinks, wl, wentry);
                 window_remove_ref(w);                  window_remove_ref(w, __func__);
         }          }
   
         RB_REMOVE(winlinks, wwl, wl);          RB_REMOVE(winlinks, wwl, wl);
Line 361 
Line 361 
 static void  static void
 window_destroy(struct window *w)  window_destroy(struct window *w)
 {  {
         if (!TAILQ_EMPTY(&w->winlinks))          log_debug("window @%u destroyed (%d references)", w->id, w->references);
                 fatalx("window destroyed with winlinks");  
   
         RB_REMOVE(windows, &windows, w);          RB_REMOVE(windows, &windows, w);
   
Line 387 
Line 386 
 }  }
   
 void  void
 window_remove_ref(struct window *w)  window_add_ref(struct window *w, const char *from)
 {  {
         if (w->references == 0)          w->references++;
                 fatal("bad reference count");          log_debug("%s: @%u %s, now %d", __func__, w->id, from, w->references);
   }
   
   void
   window_remove_ref(struct window *w, const char *from)
   {
         w->references--;          w->references--;
           log_debug("%s: @%u %s, now %d", __func__, w->id, from, w->references);
   
         if (w->references == 0)          if (w->references == 0)
                 window_destroy(w);                  window_destroy(w);
 }  }

Legend:
Removed from v.1.191  
changed lines
  Added in v.1.192