[sawfish] src/windows.c: more work on the race condition fix [Janek Kozicki]



commit 7fb415685a5babe084803d213b32b48c7ba13c85
Author: Christopher Roy Bratusek <chris nanolx org>
Date:   Fri Oct 9 22:32:48 2009 +0200

    src/windows.c: more work on the race condition fix [Janek Kozicki]

 ChangeLog     |    2 ++
 man/news.texi |    4 +++-
 src/windows.c |    7 +++++++
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0835e7a..fcf92b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2009-10-09  Christopher Bratusek <zanghar freenet de>
 	* lisp/sawfish/wm/menus.jl: added "Reload Appsmenu" entry
 
+	* src/windows.c: more work on the race condition fix [Janek Kozicki]
+
 2009-10-08  Christopher Bratusek <zanghar freenet de>
 	* ChangeLog
 	* man/sawfish.texi
diff --git a/man/news.texi b/man/news.texi
index 2045ccc..18dfc1e 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -47,7 +47,9 @@ your system, but the later doesn't
 Segfault fix: Wrap most of add_window in rep_PUSHGC/rep_POPGC
 There have been crashes that might be due to a window being
 destroyed, garbage collected and then accessed, all during
-add_window (client destroys window really quickly after mapping) [Timo Korvola]
+add_window (client destroys window really quickly after mapping),
+also prevent add_window_hook to be called with uninitialised arguement.
+[Timo Korvola, Janek Kozicki]
 
 @item Build and Installation:
 
diff --git a/src/windows.c b/src/windows.c
index ca98b13..330f763 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -530,6 +530,13 @@ add_window (Window id)
 			    rep_VAL(w));
 	  }
 	
+	/* Prevent hook call on non existing window */
+	if (WINDOW_IS_GONE_P (w))
+	{
+		rep_POPGC;
+		return 0;
+	}
+	
 	/* ..then call the add-window-hook's.. */
 	Fcall_window_hook (Qbefore_add_window_hook, rep_VAL(w), Qnil, Qnil);
 	Fcall_window_hook (Qadd_window_hook, rep_VAL(w), Qnil, Qnil);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]