Author: fnu https://www.vdr-portal.de/forum/index.php?thread/130045-produktive-problem-und-pluginl%C3%B6sungen-f%C3%BCr-vdr-2-3-2-und-h%C3%B6her/&postID=1284634#post1284634 Index: b/thread.c =================================================================== --- a/thread.c +++ b/thread.c @@ -42,9 +42,18 @@ } } +#if APIVERSNUM < 20301 cChannel *GetChannelByName(const char* Name, const cChannel *IgnoreChannel = NULL, eChannelTypes Type = ctAll) +#else +const cChannel *GetChannelByName(const char* Name, const cChannel *IgnoreChannel = NULL, eChannelTypes Type = ctAll) +#endif { +#if APIVERSNUM < 20301 for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) { +#else + LOCK_CHANNELS_READ; + for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel)) { +#endif if (strcasecmp(Name, channel->Name()) == 0 || strcasecmp(Name, channel->ShortName()) == 0) { if (IsType(channel, Type) && channel != IgnoreChannel) return channel; @@ -95,6 +104,7 @@ if (EpgSyncSetup.redirectChannels == rcmId) { // Direct import, no mapping: // loop through local channels, get channels by ID +#if APIVERSNUM < 20301 cSchedulesLock *lock = NULL; for (cChannel *channel = Channels.First(); channel && Running(); channel = Channels.Next(channel)) { @@ -102,13 +112,22 @@ lock = new cSchedulesLock(); if (cSchedules::Schedules(*lock)->GetSchedule(channel)) { DELETENULL(lock); +#else + LOCK_CHANNELS_READ; + for (const cChannel *channel = Channels->First(); channel && Running(); + channel = Channels->Next(channel)) { + LOCK_SCHEDULES_READ; + if (Schedules->GetSchedule(channel)) { +#endif if (CmdLSTE(f, *channel->GetChannelID().ToString())) { AddSchedule(f); } cCondWait::SleepMs(EPGSYNC_SLEEPMS); } } +#if APIVERSNUM < 20301 DELETENULL(lock); +#endif } else { // Map channels by name: @@ -182,7 +201,12 @@ targetChannel = NULL; const char* p = skipspace(s + 1); +#if APIVERSNUM < 20301 cChannel *c = Channels.GetByChannelID(tChannelID::FromString(p)); +#else + LOCK_CHANNELS_READ; + const cChannel *c = Channels->GetByChannelID(tChannelID::FromString(p)); +#endif bool cOk = IsType(c, (eChannelTypes) EpgSyncSetup.channelTypes); if (cOk && EpgSyncSetup.redirectChannels != rcmNameId) {