fix segfault in cSkins::Message

Message ID 200506301031.10756.wolfgang@rohdewald.de
State New
Headers

Commit Message

Wolfgang Rohdewald June 30, 2005, 8:31 a.m. UTC
  this happens if the MENUTIMEOUT makes the OSD menu 
disappear while a message is displayed.

Or if the driver/firmware is faulty and generates a timeout.
That is how I found it, but I can also reproduce it without
the driver timing out.

maybe the access to cSkinDisplay::Current is not
thread safe? What happens if it is deleted while
executing SetMessage?


vdr@mm:~/src$ diff -up skins.prev skins.c

Breakpoint 1, ~cSkinDisplay (this=0x9ef49c8) at skins.c:28
28              isyslog("~cSkinDisplay");
(gdb) bt
#0  ~cSkinDisplay (this=0x9ef49c8) at skins.c:28
#1  0x080ffceb in ~cSkinDisplayMenu (this=0x9ef49c8) at skinsttng.c:349
#2  0x080fb254 in ~cSkinClassicDisplayMenu (this=0x9ef49c8) at skinclassic.c:203
#3  0x080ddd2a in ~cOsdMenu (this=0x9ef75e8) at osdbase.c:97
#4  0x080d6d4c in ~cMenuMain (this=0x9ef75e8) at menu.c:124
#5  0x081235b5 in main (argc=14, argv=0xbfb8f9f4) at vdr.c:800
(gdb) c
Continuing.
cannot read /Musik//Deutsch/Reinhard_Mey/immer_weiter/12.Selig_sind_die_Verrückten.flac: No such file or directory

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 147463 (LWP 23498)]
0x080fec04 in cSkinClassicDisplayMessage::SetMessage (this=0x9ef4608, Type=mtInfo,
    Text=0xbe9ff734 "cannot read /Musik//Deutsch/Reinhard_Mey/immer_weiter/12.Selig_sind_die_Verrückten.flac: No such file or directory")
    at skinclassic.c:639
639       osd->DrawText(0, 0, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, Setup.OSDWidth, 0, taCenter);
  

Patch

--- skins.prev  2005-06-30 10:17:20.000000000 +0200
+++ skins.c     2005-06-30 10:17:10.000000000 +0200
@@ -191,7 +191,8 @@  eKeys cSkins::Message(eMessageType Type,
         cStatus::MsgOsdClear();
         }
      else {
-       cSkinDisplay::Current()->SetMessage(Type, NULL);
+        if (cSkinDisplay::Current())
+               cSkinDisplay::Current()->SetMessage(Type, NULL);
         cStatus::MsgOsdStatusMessage(NULL);
         }
      }