From 75ef0d7634d209a9713af62403bb08915f26fa4b Mon Sep 17 00:00:00 2001 From: horchi Date: Sun, 7 May 2017 12:07:26 +0200 Subject: 2017-05-07 version 1.1.60 (horchi)\n - bugfix: Fixed possible crash on channel lock\n\n --- update.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'update.c') diff --git a/update.c b/update.c index 1559b30..c11fc0d 100644 --- a/update.c +++ b/update.c @@ -1362,20 +1362,24 @@ void clearEpg() // Get Schedule Of //*************************************************************************** -cSchedule* getScheduleOf(tChannelID channelId, const cSchedules* schedules) +int getScheduleOf(tChannelID channelId, const cSchedules* schedules, cSchedule*& s) { cChannel* channel = 0; - cSchedule* s = 0; + + s = 0; // get channels lock #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) cStateKey channelsKey; - cChannels* channels = cChannels::GetChannelsWrite(channelsKey, 10); + cChannels* channels = cChannels::GetChannelsWrite(channelsKey, 500); #else cChannels* channels = &Channels; #endif + if (!channels) + return fail; + // get channel and schedule of channel if (channel = channels->GetByChannelID(channelId, true)) @@ -1387,7 +1391,7 @@ cSchedule* getScheduleOf(tChannelID channelId, const cSchedules* schedules) channelsKey.Remove(); #endif - return s; + return success; } //*************************************************************************** @@ -1476,7 +1480,7 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) tell(3, "LOCK (refreshEpg)"); #endif - if (!schedules || !timers) + if (!schedules || !timers || getScheduleOf(channelId, schedules, s) != success) { tell(3, "Info: Can't get write lock on '%s'", !schedules ? "schedules" : "timers"); @@ -1504,7 +1508,7 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) // lookup schedules object - if (s = getScheduleOf(channelId, schedules)) + if (s) { // ----------------------------------------- // iterate over all events of this schedule -- cgit v1.2.3