From e0697c9162accae455307fc03dc2e8cd58b54045 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Wed, 2 Oct 2013 10:20:58 +0100 Subject: [PATCH] Fixed scoping error in wSwitchPanelSelectFirst(). We were using wwin as the temporary variable in WM_ITERATE_ARRAY() but wwin was already set to the result of WMGetFromArray() and was due to be returned from the function. As a result of this oversight, wwin was always set to NULL. The bug could cause a problem in the - admittedly rare - case where all windows were minimised at startup, causing the first invocation of the switchpanel to highlight the first minimised window but then fail to raise it. Reported by Yury Tarasievich. --- src/switchpanel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switchpanel.c b/src/switchpanel.c index 424755d1..0b5b037f 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -670,7 +670,7 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back, int ignore_minimi WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back) { - WWindow *wwin; + WWindow *wwin, *tmpwin; int count = WMGetArrayItemCount(panel->windows); char *title; int i; @@ -690,7 +690,7 @@ WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back) title = wwin->frame->title; if (panel->win) { - WM_ITERATE_ARRAY(panel->windows, wwin, i) { + WM_ITERATE_ARRAY(panel->windows, tmpwin, i) { changeImage(panel, i, i == panel->current, False, False); } drawTitle(panel, panel->current, title);