From patchwork Mon Apr 10 01:50:35 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Darren Salt X-Patchwork-Id: 12247 Received: from anchor-post-30.mail.demon.net ([194.217.242.88]) by www.linuxtv.org with esmtp (Exim 4.50) id 1FSlz3-0002Fq-Ur for vdr@linuxtv.org; Mon, 10 Apr 2006 04:18:29 +0200 Received: from youmustbejoking.demon.co.uk ([212.228.127.8] helo=pentagram.youmustbejoking.demon.co.uk) by anchor-post-30.mail.demon.net with esmtp (Exim 4.42) id 1FSlz3-0001sL-1o for vdr@linuxtv.org; Mon, 10 Apr 2006 02:18:31 +0000 Received: from [192.168.0.2] (helo=riscpc) by pentagram.youmustbejoking.demon.co.uk with esmtp (Exim 4.50) id 1FSlz2-0004GO-Bv for vdr@linuxtv.org; Mon, 10 Apr 2006 03:18:28 +0100 Date: Mon, 10 Apr 2006 02:50:35 +0100 From: Darren Salt To: vdr@linuxtv.org Subject: Re: [vdr] VDR-1.3.46 Segmentation fault Message-ID: <4E152609ED%linux@youmustbejoking.demon.co.uk> References: <20060409221307.48ee6250.tom1@toms-cafe.de> <4E1510EE52%linux@youmustbejoking.demon.co.uk> In-Reply-To: <4E1510EE52%linux@youmustbejoking.demon.co.uk> User-Agent: Messenger-Pro/4.09b1 (MsgServe/3.24b1) (RISC-OS/4.02) POPstar/2.06+cvs X-Editor: Zap 1.47 (17 Oct 2005) [TEST], ZapEmail 0.28.3 (25 Mar 2005) (32) X-SDate: Mon, 4605 Sep 1993 02:50:35 +0100 X-Message-Flag: Outlook Express is broken. Upgrade to mail(1). MIME-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.0.2 X-SA-Exim-Mail-From: linux@youmustbejoking.demon.co.uk X-SA-Exim-Scanned: No (on pentagram.youmustbejoking.demon.co.uk); SAEximRunCond expanded to false X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2006 02:18:30 -0000 Status: O X-Status: X-Keywords: X-UID: 8789 I demand that I definitely did write... > I demand that Thomas Günther may or may not have written... >> If I try to set the time transponder the vdr crashes. :-( >> Program received signal SIGSEGV, Segmentation fault. >> (gdb) bt >> #0 0x401f4cff in strlen () from /lib/libc.so.6 >> #1 0x401f4a55 in strdup () from /lib/libc.so.6 >> #2 0x080e0b2f in cMenuEditItem::SetValue (this=0xa268768, Value=0x0) at menuitems.c:39 > I suggest replacing that line with > value = Value ? strdup(Value) : NULL; [snip] Full patch attached. On enabling the "set time from broadcast" function, default to the first available channel. --- vdr-1.3.46~/menuitems.c +++ vdr-1.3.46/menuitems.c @@ -36,7 +36,7 @@ void cMenuEditItem::SetValue(const char *Value) { free(value); - value = strdup(Value); + value = Value ? strdup(Value) : NULL; char *buffer = NULL; asprintf(&buffer, "%s:\t%s", name, value); SetText(buffer, false); @@ -615,61 +615,18 @@ } channel = (cChannel *)channel->Next(); } + if (!number) { + // couldn't find the selected channel, or one hasn't yet been chosen; + // default to the first available channel + channel = Channels.First(); + while (channel) { + if (!channel->GroupSep()) { + number = channel->Number(); + break; + } + channel = (cChannel *)channel->Next(); + } + } Set(); }