Added a mutex lock to protect creating/deleting cEpgHandler objects

This commit is contained in:
Klaus Schmidinger
2025-03-04 16:27:49 +01:00
parent e349523ec2
commit 6df4d96ed1
3 changed files with 11 additions and 4 deletions

View File

@@ -2596,7 +2596,8 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
for implementing cStatus::OsdCurrentItem2() with the index of the current item
for adding missing calls to cStatus::MsgOsdStatusMessage() and implementing
cStatus::OsdStatusMessage2() with the type of the message
for suggesting to add a mutex lock to protect creating/deleting cStatus objects
for suggesting to add mutex locks to protect creating/deleting cStatus and cEpgHandler
objects
Werner Färber <w.faerber@gmx.de>
for reporting a bug in handling the cPluginManager::Active() result when pressing

View File

@@ -10100,7 +10100,7 @@ Video Disk Recorder Revision History
Plugins that use these recently introduced functions need to remove the '2' from the name.
- The new virtual function cSkinDisplayMenu::SetItemEvent(..., const cTimer *Timer) can be
used to get full access to the timer (if any) defined for this event.
- Added a mutex lock to protect creating/deleting cStatus objects (suggested by Markus
Ehrnsperger).
- Added mutex locks to protect creating/deleting cStatus and cEpgHandler objects (suggested
by Markus Ehrnsperger).
- Making absolutely sure cEvent::Title() never returns NULL.
APIVERSNUM is now 30007.

8
epg.c
View File

@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 5.14 2025/03/02 11:03:35 kls Exp $
* $Id: epg.c 5.15 2025/03/04 16:27:49 kls Exp $
*/
#include "epg.h"
@@ -1421,14 +1421,20 @@ void cEpgDataReader::Action(void)
// --- cEpgHandler -----------------------------------------------------------
static cMutex Mutex;
cEpgHandler::cEpgHandler(void)
{
Mutex.Lock();
EpgHandlers.Add(this);
Mutex.Unlock();
}
cEpgHandler::~cEpgHandler()
{
Mutex.Lock();
EpgHandlers.Del(this, false);
Mutex.Unlock();
}
// --- cEpgHandlers ----------------------------------------------------------