Quick fix for a reproducible segfault with the switchpanel.
From 23d66fb78e758f98d24f844b58da61b551f266c7 Mon Sep 17 00:00:00 2001
From: Iain Patterson <w...@iain.cx>
Date: Thu, 23 May 2013 13:36:57 +0100
Subject: [PATCH 1/2] Prevent crash when switchpanel is not initialised.

A while loop in StartWindozeCycle() was checking the value of the panel
pointer and setting a flag to break out of the loop if it were NULL.
The current iteration of the loop was allowed to continue, however, with
the result that the null pointer could be passed to one of the
switchpanel functions and cause a segfault.

To reproduce, close all windows except one.  Open the inspector and set
the window's "Do not show in the switch panel" flag.  Then close the
inspector and press alt-tab to open the switchpanel.  As there is only
one window and it is not allowed to appear in the switchpanel, a null
panel pointer is returned, then later passed to wSwitchPanelSelectNext()
causing wmaker to crash.

The fix is to break out of the loop immediately instead of setting the
done flag.
---
 src/cycling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cycling.c b/src/cycling.c
index 574e0f4..44c4d1e 100644
--- a/src/cycling.c
+++ b/src/cycling.c
@@ -152,7 +152,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool 
next, Bool class_onl
                modifiers = ev.xkey.state & ValidModMask;
 
                if (!swpanel)
-                       done = True;
+                       break;
 
                switch (ev.type) {
 
-- 
1.8.1.4

Reply via email to