Hi!
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 #3 0x080e3035 in cMenuEditChanItem::Set (this=0xa268768) at menuitems.c:576 #4 0x080e332e in cMenuEditTranItem (this=0xa268768, Name=0x81c91ea "Use time from transponder", Value=0xa268374, Source=0xa268370) at menuitems.c:618 #5 0x080d17d9 in cMenuSetupEPG::Setup (this=0xa268198) at menu.c:2238 #6 0x080d1b8a in cMenuSetupEPG::ProcessKey (this=0xa268198, Key=kRight) at menu.c:2284 #7 0x080e807e in cOsdMenu::ProcessKey (this=0xa237d88, Key=kRight) at osdbase.c:463 #8 0x080d69dd in cMenuSetup::ProcessKey (this=0xa237d88, Key=kRight) at menu.c:2709 #9 0x080e807e in cOsdMenu::ProcessKey (this=0xa2382b0, Key=kRight) at osdbase.c:463 #10 0x080d8226 in cMenuMain::ProcessKey (this=0xa2382b0, Key=kRight) at menu.c:2900 #11 0x08134494 in main (argc=16, argv=0xbffffa14) at vdr.c:990
Tom
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; which _should_ show up other instances without crashing vdr - printf() and friends will handle it nicely, at least.
|Value| is getting the default value for NoneString, set when calling the constructor for cMenuEditChanItem in the constructor for cMenuEditTranItem.
[snip]
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.
On Mon, Apr 10, 2006 at 02:50:35AM +0100, Darren Salt wrote:
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.
Hmmm ... strdup() can return NULL if the system is low at or out of memory.
- value = strdup(Value);
- value = Value ? strdup(Value) : NULL;
Werner
I demand that Dr. Werner Fink may or may not have written...
On Mon, Apr 10, 2006 at 02:50:35AM +0100, Darren Salt wrote:
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.
Hmmm... strdup() can return NULL if the system is low at or out of memory.
True, but that probably doesn't matter here: something's going to fail anyway if that happens. Perhaps a wrapper is needed?
Darren Salt wrote:
I demand that Dr. Werner Fink may or may not have written...
On Mon, Apr 10, 2006 at 02:50:35AM +0100, Darren Salt wrote:
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.
Hmmm... strdup() can return NULL if the system is low at or out of memory.
True, but that probably doesn't matter here: something's going to fail anyway if that happens. Perhaps a wrapper is needed?
Memory is allocated and freed throughout the programm all the time. I don't see how it could reasonably be made to cope with running out of memory.
Back to the original problem. I prefer this fix:
--- menuitems.c 2006/04/09 13:10:02 1.36 +++ menuitems.c 2006/04/10 06:31:02 @@ -572,7 +572,7 @@ snprintf(buf, sizeof(buf), "%d %s", *value, channel ? channel->Name() : ""); SetValue(buf); } - else + else if (noneString) SetValue(noneString); }
Klaus
I demand that Klaus Schmidinger may or may not have written...
Darren Salt wrote:
I demand that Dr. Werner Fink may or may not have written...
On Mon, Apr 10, 2006 at 02:50:35AM +0100, Darren Salt wrote:
[snip]
Full patch attached. On enabling the "set time from broadcast" function, default to the first available channel.
Hmmm... strdup() can return NULL if the system is low at or out of memory.
True, but that probably doesn't matter here: something's going to fail anyway if that happens. Perhaps a wrapper is needed?
Memory is allocated and freed throughout the program all the time. I don't see how it could reasonably be made to cope with running out of memory.
</AOL>, though that's not the reason for the wrapper:
char *my_strdup (const char *str) { return str ? strdup (str) : NULL; }
would do very nicely.
Back to the original problem. I prefer this fix:
--- menuitems.c 2006/04/09 13:10:02 1.36 +++ menuitems.c 2006/04/10 06:31:02 @@ -572,7 +572,7 @@ snprintf(buf, sizeof(buf), "%d %s", *value, channel ? channel->Name() : ""); SetValue(buf); }
- else
- else if (noneString) SetValue(noneString); }
That still leaves no selected multiplex when "set time from broadcast" is initially enabled (i.e. TimeSource = 0, TimeTransponder = 0) - and your preferred fix will cause cMenuEditChanItem::Set() to do nothing. Is this intended? If not, then you should consider the second part of my patch.
BTW, what should happen to that setting when all entries for the channels in that multiplex are deleted?
Darren Salt wrote:
I demand that Klaus Schmidinger may or may not have written...
Darren Salt wrote:
I demand that Dr. Werner Fink may or may not have written...
On Mon, Apr 10, 2006 at 02:50:35AM +0100, Darren Salt wrote:
[snip]
Full patch attached. On enabling the "set time from broadcast" function, default to the first available channel.
Hmmm... strdup() can return NULL if the system is low at or out of memory.
True, but that probably doesn't matter here: something's going to fail anyway if that happens. Perhaps a wrapper is needed?
Memory is allocated and freed throughout the program all the time. I don't see how it could reasonably be made to cope with running out of memory.
</AOL>, though that's not the reason for the wrapper:
Sorry, from Werner's remark "strdup() can return NULL if the system is low at or out of memory" I (apparently wrongfully) assumed that your answer was going in that direction.
char *my_strdup (const char *str) { return str ? strdup (str) : NULL; }
would do very nicely.
Back to the original problem. I prefer this fix:
--- menuitems.c 2006/04/09 13:10:02 1.36 +++ menuitems.c 2006/04/10 06:31:02 @@ -572,7 +572,7 @@ snprintf(buf, sizeof(buf), "%d %s", *value, channel ? channel->Name() : ""); SetValue(buf); }
- else
- else if (noneString) SetValue(noneString);
}
That still leaves no selected multiplex when "set time from broadcast" is initially enabled (i.e. TimeSource = 0, TimeTransponder = 0) - and your preferred fix will cause cMenuEditChanItem::Set() to do nothing. Is this intended? If not, then you should consider the second part of my patch.
Well, the actual fix for the initial problem was the mising check for noneString != NULL.
With the new "NoneString" parameter of cMenuEditChanItem we could do
cMenuEditTranItem::cMenuEditTranItem(const char *Name, int *Value, int *Source) :cMenuEditChanItem(Name, &number, "-")
so that there is actually a visible indication that no transponder for setting the time has been selected , yet. Automatically setting the transponder to the first available one is IMHO not a good idea - I prefer to have the user explicitly select his/her poison ;-).
BTW, what should happen to that setting when all entries for the channels in that multiplex are deleted?
Well, in that case the system time will no longer be set, because ISTRANSPONDER(Transponder(), Setup.TimeTransponder) will never match. And when the user opens the setup menu, the "Use time from transponder" entry will be empty (or "-" with the above change).
Klaus
Klaus Schmidinger wrote:
I prefer this fix:
--- menuitems.c 2006/04/09 13:10:02 1.36 +++ menuitems.c 2006/04/10 06:31:02 @@ -572,7 +572,7 @@ snprintf(buf, sizeof(buf), "%d %s", *value, channel ? channel->Name() : ""); SetValue(buf); }
- else
- else if (noneString) SetValue(noneString); }
Thanks, this works.
But if I set "Set system time" from no to yes, "Use time from transponder" shows channel 3068. Scrolling right it goes to channel 1. So this is no great problem.
I suggest a handling like "Intial channel": no - 1 - 2 - ...
Tom