Re: [vdr] Crash on first start without setup.conf

2011-12-10 Thread Klaus Schmidinger

On 09.12.2011 19:15, Juergen Lock wrote:

Hi!

  (I'm still on 1.7.19 so forgive me if this already has been solved...)


I forgive you ;-)

Actually it has been fixed in version 1.7.20, with an additional
fix in 1.7.21.

Klaus


  I just got a report that starting vdr without setup.conf crashes in
isnumber(Setup.InitialChannel) called from main() so I came up with
this bandaid fix:

--- vdr.c.orig
+++ vdr.c
@@ -735,6 +735,8 @@ int main(int argc, char *argv[])

if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT))
   dsyslog(not all devices ready after %d seconds, DEVICEREADYTIMEOUT);
+  if (((const char *)Setup.InitialChannel) == NULL)
+ Setup.InitialChannel = 0;
if (isnumber(Setup.InitialChannel)) { // for compatibility with old 
setup.conf files
   if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel)))
  Setup.InitialChannel = Channel-GetChannelID().ToString();

  Is that ok or should cSetup::cSetup(void) in config.c be changed,
it doesn't initialize InitialChannel, there only is a comment:

   // InitialChannel is initialized by constructor

  Thanx,
Juergen


___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] Crash on first start without setup.conf

2011-12-10 Thread Juergen Lock
In article 4ee366f8.2030...@tvdr.de you write:
On 09.12.2011 19:15, Juergen Lock wrote:
 Hi!

   (I'm still on 1.7.19 so forgive me if this already has been solved...)

I forgive you ;-)

Actually it has been fixed in version 1.7.20, with an additional
fix in 1.7.21.

Thanx! :)

 This is the patch I merged into FreeBSD ports for now until I get
around to updating to 1.7.22:

--- config.c.orig
+++ config.c
@@ -399,7 +399,7 @@ cSetup::cSetup(void)
   CurrentChannel = -1;
   CurrentVolume = MAXVOLUME;
   CurrentDolby = 0;
-  // InitialChannel is initialized by constructor
+  InitialChannel = ;
   InitialVolume = -1;
   ChannelsWrap = 0;
   EmergencyExit = 1;
--- vdr.c.orig
+++ vdr.c
@@ -735,12 +723,14 @@ int main(int argc, char *argv[])
 
   if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT))
  dsyslog(not all devices ready after %d seconds, DEVICEREADYTIMEOUT);
-  if (isnumber(Setup.InitialChannel)) { // for compatibility with old 
setup.conf files
- if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel)))
-Setup.InitialChannel = Channel-GetChannelID().ToString();
+  if (*Setup.InitialChannel) {
+ if (isnumber(Setup.InitialChannel)) { // for compatibility with old 
setup.conf files
+if (cChannel *Channel = 
Channels.GetByNumber(atoi(Setup.InitialChannel)))
+   Setup.InitialChannel = Channel-GetChannelID().ToString();
+}
+ if (cChannel *Channel = 
Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel)))
+Setup.CurrentChannel = Channel-Number();
  }
-  if (cChannel *Channel = 
Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel)))
- Setup.CurrentChannel = Channel-Number();
   if (Setup.InitialVolume = 0)
  Setup.CurrentVolume = Setup.InitialVolume;
   Channels.SwitchTo(Setup.CurrentChannel);

 That seems to fix the problem for me.

 Cheers,
Juergen

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr