1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

cOsdProvider::NewOsd() now always returns a valid pointer

This commit is contained in:
Klaus Schmidinger 2004-10-16 11:05:14 +02:00
parent 1a2ddff60d
commit 27895be475
3 changed files with 13 additions and 9 deletions

View File

@ -3009,3 +3009,6 @@ Video Disk Recorder Revision History
- Fixed a possible crash with inconsistent SI data (thanks to Marcel Wiesweg).
- Fixed showing the replay mode if the OSD is currently in use (thanks to Kimmo
Tykkala for pointing out this problem).
- cOsdProvider::NewOsd() now always returns a valid pointer, even if the OSD is
currently in use (it will then return a dummy cOsd object and write a message to
the log file).

13
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.c 1.57 2004/07/18 09:23:03 kls Exp $
* $Id: osd.c 1.58 2004/10/16 10:31:34 kls Exp $
*/
#include "osd.h"
@ -716,13 +716,12 @@ cOsdProvider::~cOsdProvider()
cOsd *cOsdProvider::NewOsd(int Left, int Top)
{
if (cOsd::IsOpen()) {
esyslog("ERROR: attempt to open OSD while it is already open!");
return NULL;
}
if (osdProvider)
if (Level == 0 && cOsd::IsOpen())
esyslog("ERROR: attempt to open OSD while it is already open - using dummy OSD!");
else if (osdProvider)
return osdProvider->CreateOsd(Left, Top);
esyslog("ERROR: no OSD provider available - using dummy OSD!");
else
esyslog("ERROR: no OSD provider available - using dummy OSD!");
return new cOsd(Left, Top); // create a dummy cOsd, so that access won't result in a segfault
}

6
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.46 2004/06/12 13:14:48 kls Exp $
* $Id: osd.h 1.47 2004/10/16 10:33:44 kls Exp $
*/
#ifndef __OSD_H
@ -330,7 +330,9 @@ public:
static cOsd *NewOsd(int Left, int Top);
///< Returns a pointer to a newly created cOsd object, which will be located
///< at the given coordinates. When the cOsd object is no longer needed, the
///< caller must delete it.
///< caller must delete it. If the OSD is already in use, or there is no OSD
///< provider, a dummy OSD is returned so that the caller may always use the
///< returned pointer without having to check it every time it is accessed.
static void Shutdown(void);
///< Shuts down the OSD provider facility by deleting the current OSD provider.
};