Prevent crash when switchpanel is not initialised.
commitbf9e0252894f8501ef781e40bfed42264cee0b19
authorIain Patterson <wm@iain.cx>
Thu, 23 May 2013 12:36:57 +0000 (23 13:36 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Thu, 23 May 2013 17:19:45 +0000 (23 18:19 +0100)
treed63af0651c47c80f43cb4faccbe136967e94bf33
parent936a85ce253a12425e4462ef6085b3c34ac3376d
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