From: Christophe CURIS <[email protected]> As reported by Juan Giordana, there are some cases where wmaker could crash when displaying the switch panel.
This patch does not fixes the root problem, but adds proper checks so that at least wmaker will not crash. Signed-off-by: Christophe CURIS <[email protected]> --- src/switchpanel.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/switchpanel.c b/src/switchpanel.c index 62ced77..5471401 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -112,9 +112,9 @@ static Bool sameWindowClass(WWindow *wwin, WWindow *curwin) static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim, Bool force) { - WMFrame *icon = WMGetFromArray(panel->icons, idecks); - RImage *image = WMGetFromArray(panel->images, idecks); - char flags = (char) (uintptr_t) WMGetFromArray(panel->flags, idecks); + WMFrame *icon = NULL; + RImage *image = NULL; + char flags; char desired = 0; if (selected) @@ -122,11 +122,37 @@ static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim, if (dim) desired |= ICON_DIM; + if (panel->flags == NULL) { +#ifdef DEBUG + wwarning("panel->flags is NULL, this may not be right"); +#endif + return; + } + + flags = (char) (uintptr_t) WMGetFromArray(panel->flags, idecks); if (flags == desired && !force) return; WMReplaceInArray(panel->flags, idecks, (void *) (uintptr_t) desired); + if (panel->icons) { + icon = WMGetFromArray(panel->icons, idecks); +#ifdef DEBUG + } else { + wwarning("panel->icons is NULL, this may not be right"); +#endif + } + if (icon == NULL) + return; + + if (panel->images) { + image = WMGetFromArray(panel->images, idecks); +#ifdef DEBUG + } else { + wwarning("panel->images is NULL, this may not be right"); +#endif + } + if (!panel->bg && !panel->tile && !selected) WMSetFrameRelief(icon, WRFlat); -- 1.7.10.4 -- To unsubscribe, send mail to [email protected].
