diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-07-05 12:39:07 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-07-05 13:05:19 +0200 |
commit | a88154614c3fd0eefb30536fa7ff9d7bfd8ca2c4 (patch) | |
tree | 722c1a1f511ca86d679f21aea936471677c5fc78 | |
parent | deaece203463f97f1e3a787f40f2cc2560d78826 (diff) | |
download | vdr-plugin-tvguideng-a88154614c3fd0eefb30536fa7ff9d7bfd8ca2c4.tar.gz vdr-plugin-tvguideng-a88154614c3fd0eefb30536fa7ff9d7bfd8ca2c4.tar.bz2 |
Fixed locking in searchtimer.c and recmanager.c
-rw-r--r-- | recmanager.c | 15 | ||||
-rw-r--r-- | searchtimer.c | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/recmanager.c b/recmanager.c index 7dbfc0f..c470073 100644 --- a/recmanager.c +++ b/recmanager.c @@ -403,12 +403,14 @@ const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString int eventID = atoi(flds[1].c_str()); std::string channelID = flds[7]; tChannelID chanID = tChannelID::FromString(channelID.c_str()); - + const cChannels* channels; #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + { LOCK_CHANNELS_READ; - const cChannels* channels = Channels; + channels = Channels; + } #else - cChannels* channels = &Channels; + channels = &Channels; #endif const cChannel *channel = channels->GetByChannelID(chanID); @@ -518,11 +520,14 @@ void cRecManager::DeleteSearchTimer(cTVGuideSearchTimer *searchTimer, bool delTi return; int searchTimerID = searchTimer->GetID(); if (delTimers) { + cTimers* timers; #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + { LOCK_TIMERS_WRITE; - cTimers* timers = Timers; + timers = Timers; + } #else - cTimers* timers = &Timers; + timers = &Timers; #endif cTimer *timer = timers->First(); while (timer) { diff --git a/searchtimer.c b/searchtimer.c index 22d1313..6d748e5 100644 --- a/searchtimer.c +++ b/searchtimer.c @@ -17,9 +17,11 @@ cTVGuideSearchTimer::cTVGuideSearchTimer(void) { stopTime = 2359; useChannel = false; #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + { LOCK_CHANNELS_READ; channelMin = Channels->GetByNumber(cDevice::CurrentChannel()); channelMax = Channels->GetByNumber(cDevice::CurrentChannel()); + } #else channelMin = Channels.GetByNumber(cDevice::CurrentChannel()); channelMax = Channels.GetByNumber(cDevice::CurrentChannel()); @@ -247,11 +249,11 @@ bool cTVGuideSearchTimer::Parse(bool readTemplate) { int channels = sscanf(values[value].c_str(), "%m[^|]|%m[^|]", &channelMinbuffer, &channelMaxbuffer); #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) LOCK_CHANNELS_READ; - const cChannels* channelsP = Channels; + const cChannels* channelsP = Channels; #else cChannels* channelsP = &Channels; #endif - channelMin = channelsP->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true); + channelMin = channelsP->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true); if (!channelMin) { channelMin = channelMax = NULL; useChannel = 0; |