Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: OSD "ERROR: attempt to open OSD while it is alreadyopen!"
Achim Tuffentsammer wrote:
Nicolas Huillard wrote:
Since cOsdProvider::NewOsd() can return NULL, osd->anything shouldn't
be called without testing.
I simply cannot decide how to handle the case, since we are in the
constructor cSkinSTTNGDisplayMessage::cSkinSTTNGDisplayMessage and
many methods after that will try to use the osd property, and crash...
The cSkinSTTNGDisplayMessage should simply abort it's construction,
but I don't know how to write it in C++...
Why don't you simply return from the constructor after NewOsd returns NULL?
There was a patch posted some days ago concerning this problem:
http://www.linuxtv.org/mailinglists/vdr/2004/07-2004/msg00520.html
I started from this post and the answer from Klaus, and went Klaus's
way. See attached patch.
This patch solve the problem, whatever skin is used. The other way would
involve patching every skin, to check the return value of
cOsdProvider::NewOsd(), that can be NULL. This fix would be necessary,
but involve each and every method of all skins around... I'm just lazy.
There must be other cases where this bug bites. I don't know enough the
code to search for them all.
--
NH
--- vdr-1.3.12.orig/skins.c
+++ vdr-1.3.12/skins.c
@@ -172,25 +172,27 @@
case mtError: esyslog("ERROR: %s", s); break;
default: ;
}
- if (!cSkinDisplay::Current() && !displayMessage)
- displayMessage = Current()->DisplayMessage();
- cSkinDisplay::Current()->SetMessage(Type, s);
- cSkinDisplay::Current()->Flush();
- cStatus::MsgOsdStatusMessage(s);
eKeys k = kNone;
- if (Type != mtStatus) {
- k = Interface->Wait(Seconds);
- if (displayMessage) {
- delete displayMessage;
- displayMessage = NULL;
- }
- else
- cSkinDisplay::Current()->SetMessage(Type, NULL);
- }
- else if (!s && displayMessage) {
- delete displayMessage;
- displayMessage = NULL;
- }
+ if (!cOsd::IsOpen()) {
+ if (!cSkinDisplay::Current() && !displayMessage)
+ displayMessage = Current()->DisplayMessage();
+ cSkinDisplay::Current()->SetMessage(Type, s);
+ cSkinDisplay::Current()->Flush();
+ cStatus::MsgOsdStatusMessage(s);
+ if (Type != mtStatus) {
+ k = Interface->Wait(Seconds);
+ if (displayMessage) {
+ delete displayMessage;
+ displayMessage = NULL;
+ }
+ else
+ cSkinDisplay::Current()->SetMessage(Type, NULL);
+ }
+ else if (!s && displayMessage) {
+ delete displayMessage;
+ displayMessage = NULL;
+ }
+ }
return k;
}
Home |
Main Index |
Thread Index