Added a mutex lock to protect creating/deleting cStatus objects

This commit is contained in:
Klaus Schmidinger
2025-03-03 13:31:10 +01:00
parent 468b0ee560
commit ecfe144218
3 changed files with 12 additions and 2 deletions

View File

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

View File

@@ -10090,7 +10090,7 @@ Video Disk Recorder Revision History
- Added missing locks to SetMenuItem() functions. - Added missing locks to SetMenuItem() functions.
- Revised locking in cMenuSchedule and cMenuWhatsOn. - Revised locking in cMenuSchedule and cMenuWhatsOn.
2025-03-02: 2025-03-03:
- Added the "override" keyword to virtual functions reimplemented in derived classes. - Added the "override" keyword to virtual functions reimplemented in derived classes.
Plugins may want to do the same, but don't have to. Plugins may want to do the same, but don't have to.
@@ -10100,3 +10100,5 @@ Video Disk Recorder Revision History
Plugins that use these recently introduced functions need to remove the '2' from the name. 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 - 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. 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).

View File

@@ -4,23 +4,30 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: status.c 5.4 2025/03/02 21:02:12 kls Exp $ * $Id: status.c 5.5 2025/03/03 13:31:10 kls Exp $
*/ */
#include "status.h" #include "status.h"
#include "thread.h"
// --- cStatus --------------------------------------------------------------- // --- cStatus ---------------------------------------------------------------
cList<cStatus> cStatus::statusMonitors; cList<cStatus> cStatus::statusMonitors;
static cMutex Mutex;
cStatus::cStatus(void) cStatus::cStatus(void)
{ {
Mutex.Lock();
statusMonitors.Add(this); statusMonitors.Add(this);
Mutex.Unlock();
} }
cStatus::~cStatus() cStatus::~cStatus()
{ {
Mutex.Lock();
statusMonitors.Del(this, false); statusMonitors.Del(this, false);
Mutex.Unlock();
} }
void cStatus::MsgChannelChange(const cChannel *Channel) void cStatus::MsgChannelChange(const cChannel *Channel)