Revision: 2864
http://tmux.svn.sourceforge.net/tmux/?rev=2864&view=rev
Author: tcunha
Date: 2012-08-31 09:22:08 +0000 (Fri, 31 Aug 2012)
Log Message:
-----------
Sync OpenBSD patchset 1165:
Fix up window reference counting and don't crash if the rename timer
fires while the window is dead but still referenced. Fixes problem
reported by Michael Scholz.
Modified Paths:
--------------
trunk/names.c
trunk/notify.c
trunk/tmux.h
trunk/window.c
Modified: trunk/names.c
===================================================================
--- trunk/names.c 2012-08-31 09:20:47 UTC (rev 2863)
+++ trunk/names.c 2012-08-31 09:22:08 UTC (rev 2864)
@@ -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);
Modified: trunk/notify.c
===================================================================
--- trunk/notify.c 2012-08-31 09:20:47 UTC (rev 2863)
+++ trunk/notify.c 2012-08-31 09:22:08 UTC (rev 2864)
@@ -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(¬ify_queue, ne, entry);
free(ne);
}
Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h 2012-08-31 09:20:47 UTC (rev 2863)
+++ trunk/tmux.h 2012-08-31 09:22:08 UTC (rev 2864)
@@ -2126,6 +2126,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 *);
Modified: trunk/window.c
===================================================================
--- trunk/window.c 2012-08-31 09:20:47 UTC (rev 2863)
+++ trunk/window.c 2012-08-31 09:22:08 UTC (rev 2864)
@@ -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);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
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-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs