From patchwork Sat Oct 8 10:00:41 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 12058 Received: from moutng.kundenserver.de ([212.227.126.177]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EOBVk-0003x5-DT for vdr@linuxtv.org; Sat, 08 Oct 2005 12:01:00 +0200 Received: from p54B4E9F0.dip.t-dialin.net [84.180.233.240] (helo=mail.bigo.ensc.de) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0ML29c-1EOBVY1XJw-0005f5; Sat, 08 Oct 2005 12:00:48 +0200 Received: from kosh.bigo.ensc.de (kosh.bigo.ensc.de [192.168.46.2]) by mail.bigo.ensc.de (8.13.4/8.13.3) with ESMTP id j98A0gEF001842 for ; Sat, 8 Oct 2005 12:00:44 +0200 Received: (from ensc@localhost) by kosh.bigo.ensc.de (8.13.4/8.13.3/Submit) id j98A0g5F009846; Sat, 8 Oct 2005 12:00:42 +0200 To: vdr@linuxtv.org From: Enrico Scholz Date: Sat, 08 Oct 2005 12:00:41 +0200 Message-ID: <87vf089vli.fsf@kosh.bigo.ensc.de> User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) MIME-Version: 1.0 X-Provags-ID: kundenserver.de abuse@kundenserver.de login:cf015127439e61eb16a460417aa16ac1 Subject: [vdr] [PATCH] Endless loops in keyup/down handlers X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Oct 2005 10:01:00 -0000 Status: O X-Status: X-Keywords: X-UID: 5389 Hello, when MenuScrollWrap is activated, menues are going into an endless loop when there are no selectable items. E.g. after 'Recordings' -> 1 -> Up, vdr does not respond anymore. Same happens for non-empty menues which do not have selectable items. The attached patch fixes this (written for 1.3.33, but applies to 1.3.34 too). Enrico 2005-10-03 17:52 Enrico Scholz - osdbase.c: prevent an endless loop in the keyup/down handlers when no selectable entries are available and MenuScrollWrap is activated --- vdr-1.3.33/osdbase.c.noinfloop 2005-10-03 17:04:16.000000000 +0200 +++ vdr-1.3.33/osdbase.c 2005-10-03 17:04:51.000000000 +0200 @@ -266,14 +266,17 @@ int tmpCurrent = current; int lastOnScreen = first + displayMenuItems - 1; int last = Count() - 1; + if (last==-1) + return; + while (--tmpCurrent != current) { if (tmpCurrent < 0) { if (Setup.MenuScrollWrap) - tmpCurrent = last; + tmpCurrent = last+1; else return; } - if (SelectableItem(tmpCurrent)) + else if (SelectableItem(tmpCurrent)) break; } if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) @@ -296,14 +299,17 @@ int tmpCurrent = current; int lastOnScreen = first + displayMenuItems - 1; int last = Count() - 1; + if (last==-1) + return; + while (++tmpCurrent != current) { if (tmpCurrent > last) { if (Setup.MenuScrollWrap) - tmpCurrent = 0; + tmpCurrent = -1; else return; } - if (SelectableItem(tmpCurrent)) + else if (SelectableItem(tmpCurrent)) break; } if (first <= tmpCurrent && tmpCurrent <= lastOnScreen)