Added some missing locking

This commit is contained in:
Klaus Schmidinger 2024-12-02 12:40:56 +01:00
parent ccbef6ce6c
commit e4e9d7a55f
4 changed files with 19 additions and 10 deletions

View File

@ -10034,7 +10034,7 @@ Video Disk Recorder Revision History
(suggested by Stefan Hofmann). (suggested by Stefan Hofmann).
- Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann). - Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann).
2024-11-30: 2024-12-02:
- Removed all DEPRECATED_* code. - Removed all DEPRECATED_* code.
- Fixed error checking in case the fps value can't be determined by the frame parser. - Fixed error checking in case the fps value can't be determined by the frame parser.
@ -10042,3 +10042,4 @@ Video Disk Recorder Revision History
- The VDR homepage is now accessible via HTTPS. - The VDR homepage is now accessible via HTTPS.
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed some typos in the translation files (thanks to Stefan Hofmann). - Fixed some typos in the translation files (thanks to Stefan Hofmann).
- Added some missing locking.

8
menu.c
View File

@ -4,7 +4,7 @@
* 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: menu.c 5.18 2024/10/11 14:10:50 kls Exp $ * $Id: menu.c 5.19 2024/12/02 12:40:56 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1263,6 +1263,7 @@ void cMenuTimerItem::Set(void)
} }
const char *File = timer->Pattern(); const char *File = timer->Pattern();
if (!*File) { if (!*File) {
LOCK_SCHEDULES_READ;
if (timer->HasFlags(tfSpawned) && timer->Event() && timer->Event()->Title()) if (timer->HasFlags(tfSpawned) && timer->Event() && timer->Event()->Title())
File = timer->Event()->Title(); File = timer->Event()->Title();
else { else {
@ -1334,12 +1335,15 @@ void cMenuTimers::Set(void)
const cTimer *CurrentTimer = GetTimer(); const cTimer *CurrentTimer = GetTimer();
cMenuTimerItem *CurrentItem = NULL; cMenuTimerItem *CurrentItem = NULL;
Clear(); Clear();
{
LOCK_SCHEDULES_READ;
for (const cTimer *Timer = Timers->First(); Timer; Timer = Timers->Next(Timer)) { for (const cTimer *Timer = Timers->First(); Timer; Timer = Timers->Next(Timer)) {
cMenuTimerItem *Item = new cMenuTimerItem(Timer); cMenuTimerItem *Item = new cMenuTimerItem(Timer);
Add(Item); Add(Item);
if (CurrentTimer && Timer->Id() == CurrentTimer->Id() && (!Timer->Remote() && !CurrentTimer->Remote() || Timer->Remote() && CurrentTimer->Remote() && strcmp(Timer->Remote(), CurrentTimer->Remote()) == 0)) if (CurrentTimer && Timer->Id() == CurrentTimer->Id() && (!Timer->Remote() && !CurrentTimer->Remote() || Timer->Remote() && CurrentTimer->Remote() && strcmp(Timer->Remote(), CurrentTimer->Remote()) == 0))
CurrentItem = Item; CurrentItem = Item;
} }
}
Sort(); Sort();
SetCurrent(CurrentItem ? CurrentItem : First()); SetCurrent(CurrentItem ? CurrentItem : First());
SetHelpKeys(); SetHelpKeys();
@ -1454,6 +1458,7 @@ eOSState cMenuTimers::Info(void)
return osContinue; return osContinue;
LOCK_TIMERS_READ; LOCK_TIMERS_READ;
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
LOCK_SCHEDULES_READ;
cTimer *Timer = GetTimer(); cTimer *Timer = GetTimer();
if (Timer && Timer->Event()) if (Timer && Timer->Event())
return AddSubMenu(new cMenuEvent(Timers, Channels, Timer->Event())); return AddSubMenu(new cMenuEvent(Timers, Channels, Timer->Event()));
@ -1599,6 +1604,7 @@ static const char *TimerMatchChars = " tT iI";
bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force) bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force)
{ {
LOCK_SCHEDULES_READ;
eTimerMatch OldTimerMatch = timerMatch; eTimerMatch OldTimerMatch = timerMatch;
bool OldTimerActive = timerActive; bool OldTimerActive = timerActive;
const cTimer *Timer = Timers->GetMatch(event, &timerMatch); const cTimer *Timer = Timers->GetMatch(event, &timerMatch);

View File

@ -4,7 +4,7 @@
* 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: skinlcars.c 5.7 2024/09/21 10:53:07 kls Exp $ * $Id: skinlcars.c 5.8 2024/12/02 12:40:56 kls Exp $
*/ */
// "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures, // "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures,
@ -1259,6 +1259,7 @@ void cSkinLCARSDisplayMenu::DrawTimers(void)
int NumDevices = 0; int NumDevices = 0;
int y = ys04; int y = ys04;
// Timers and recording devices: // Timers and recording devices:
LOCK_SCHEDULES_READ;
while (1) { while (1) {
int NumTimers = 0; int NumTimers = 0;
const cDevice *Device = NULL; const cDevice *Device = NULL;

3
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at https://www.tvdr.de * The project's page is at https://www.tvdr.de
* *
* $Id: vdr.c 5.17 2024/10/21 19:03:09 kls Exp $ * $Id: vdr.c 5.18 2024/12/02 12:40:56 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -1140,6 +1140,7 @@ int main(int argc, char *argv[])
if (Timer->Matches(Now, true, Setup.VpsMargin)) if (Timer->Matches(Now, true, Setup.VpsMargin))
InVpsMargin = true; InVpsMargin = true;
else if (Timer->Event()) { else if (Timer->Event()) {
LOCK_SCHEDULES_READ;
InVpsMargin = Timer->Event()->StartTime() <= Now && Now < Timer->Event()->EndTime(); InVpsMargin = Timer->Event()->StartTime() <= Now && Now < Timer->Event()->EndTime();
NeedsTransponder = Timer->Event()->StartTime() - Now < VPSLOOKAHEADTIME * 3600 && !Timer->Event()->SeenWithin(VPSUPTODATETIME); NeedsTransponder = Timer->Event()->StartTime() - Now < VPSLOOKAHEADTIME * 3600 && !Timer->Event()->SeenWithin(VPSUPTODATETIME);
} }