mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 13:28:05 +01:00
Don't crash when SwitchPanelImages is None.
The whole changeImage() function in switchpanel.c is a no-op if wPreferences.swtileImage is set to None because the panel isn't actually drawn in that case. As a consequence there are no images to change. As well as being logically incorrect the existing code causes a segfault if the user has the SwitchPanelImages preference set to None because changeImage() would attempt to access the icons and images arrays which are only initialised in wInitSwitchPanel() when swtileImage has a value. Bug report and diagnosis by Juan Giordana, Gabriel Vlasiu and Christophe Curis.
This commit is contained in:
committed by
Carlos R. Mafra
parent
527f5f1730
commit
3966cd2fc2
@@ -112,11 +112,19 @@ static Bool sameWindowClass(WWindow *wwin, WWindow *curwin)
|
|||||||
|
|
||||||
static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim, Bool force)
|
static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim, Bool force)
|
||||||
{
|
{
|
||||||
WMFrame *icon = WMGetFromArray(panel->icons, idecks);
|
WMFrame *icon = NULL;
|
||||||
RImage *image = WMGetFromArray(panel->images, idecks);
|
RImage *image = NULL;
|
||||||
char flags = (char) (uintptr_t) WMGetFromArray(panel->flags, idecks);
|
char flags = 0;
|
||||||
char desired = 0;
|
char desired = 0;
|
||||||
|
|
||||||
|
/* This whole function is a no-op if we aren't drawing the panel */
|
||||||
|
if (!wPreferences.swtileImage)
|
||||||
|
return;
|
||||||
|
|
||||||
|
icon = WMGetFromArray(panel->icons, idecks);
|
||||||
|
image = WMGetFromArray(panel->images, idecks);
|
||||||
|
flags = (char) (uintptr_t) WMGetFromArray(panel->flags, idecks);
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
desired |= ICON_SELECTED;
|
desired |= ICON_SELECTED;
|
||||||
if (dim)
|
if (dim)
|
||||||
|
|||||||
Reference in New Issue
Block a user