summaryrefslogtreecommitdiff
path: root/update.c
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-05-07 12:07:26 +0200
committerhorchi <vdr@jwendel.de>2017-05-07 12:07:26 +0200
commit75ef0d7634d209a9713af62403bb08915f26fa4b (patch)
tree49dcce38ebf652709c08f5c261a76a7a15933b6d /update.c
parent65ef548b3b1e80d37da6db48e0648fc4485d14c7 (diff)
downloadvdr-plugin-epg2vdr-75ef0d7634d209a9713af62403bb08915f26fa4b.tar.gz
vdr-plugin-epg2vdr-75ef0d7634d209a9713af62403bb08915f26fa4b.tar.bz2
2017-05-07 version 1.1.60 (horchi)\n - bugfix: Fixed possible crash on channel lock\n\n1.1.60
Diffstat (limited to 'update.c')
-rw-r--r--update.c16
1 files changed, 10 insertions, 6 deletions
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