summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomJoad <TomJoad@vdr-portal.de>2017-06-07 19:54:19 (GMT)
committerFrank Neumann <fnu@yavdr.org>2017-06-07 19:54:19 (GMT)
commitcb315679bdb548a4bfd5d6d9341f6f15bd96223b (patch)
treef841d0967306fdd2d5bccea9c9f91929abc1cfaa
parent9bfa02dd31798d816ada3ebec1c4d7242300cf95 (diff)
downloadvdr-plugin-epgsearch-cb315679bdb548a4bfd5d6d9341f6f15bd96223b.tar.gz
vdr-plugin-epgsearch-cb315679bdb548a4bfd5d6d9341f6f15bd96223b.tar.bz2
Fix some lock sequences.
-rw-r--r--epgsearchext.c8
-rw-r--r--menu_main.c37
-rw-r--r--menu_main.h2
3 files changed, 28 insertions, 19 deletions
diff --git a/epgsearchext.c b/epgsearchext.c
index b516c9c..bfe8b5c 100644
--- a/epgsearchext.c
+++ b/epgsearchext.c
@@ -1015,9 +1015,6 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
{
LogFile.Log(3,"start search for search timer '%s'", search);
- LOCK_CHANNELS_READ; // Channels must be locked first
- LOCK_SCHEDULES_READ;
-
bool noPayTV = false;
if (PayTVMode == -1) // use search's setting
noPayTV = (useChannel == 3);
@@ -1028,6 +1025,10 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
cSearchResults* pSearchResults = pPrevResults;
cSearchResults* pBlacklistResults = GetBlacklistEvents(inspectTimerMargin?MarginStop:0);
+ {
+ LOCK_CHANNELS_READ;
+ LOCK_SCHEDULES_READ;
+
int counter = 0;
const cSchedule *Schedule = Schedules->First();
while (Schedule) {
@@ -1098,6 +1099,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
Schedule = (const cSchedule *)Schedules->Next(Schedule);
}
LogFile.Log(3,"found %d event(s) for search timer '%s'", counter, search);
+ } // Give up locks
if (pBlacklistResults) delete pBlacklistResults;
diff --git a/menu_main.c b/menu_main.c
index 2800114..912affe 100644
--- a/menu_main.c
+++ b/menu_main.c
@@ -56,10 +56,11 @@ cMenuSearchMain::cMenuSearchMain(void)
shiftTime = 0;
InWhatsOnMenu = false;
InFavoritesMenu = false;
+ const cChannel *channel;
+ {
LOCK_CHANNELS_READ;
- LOCK_SCHEDULES_READ;
- schedules = Schedules;
- const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
+ channel = Channels->GetByNumber(cDevice::CurrentChannel());
+ }
if (channel) {
cMenuWhatsOnSearch::SetCurrentChannel(channel->Number());
if (EPGSearchConfig.StartMenu == 0 || forceMenu != 0)
@@ -73,8 +74,9 @@ cMenuSearchMain::cMenuSearchMain(void)
}
if ((EPGSearchConfig.StartMenu == 1 || forceMenu == 1) && forceMenu != 2)
{
+ LOCK_SCHEDULES_READ;
InWhatsOnMenu = true;
- AddSubMenu(new cMenuWhatsOnSearch(schedules, cDevice::CurrentChannel()));
+ AddSubMenu(new cMenuWhatsOnSearch(Schedules, cDevice::CurrentChannel()));
}
if (forceMenu == 3)
ShowSummary();
@@ -117,8 +119,11 @@ void cMenuSearchMain::PrepareSchedule(const cChannel *Channel)
cMenuTemplate* ScheduleTemplate = cTemplFile::GetTemplateByName("MenuSchedule");
eventObjects.Clear();
- if (schedules) {
- const cSchedule *Schedule = schedules->GetSchedule(Channel);
+ const cSchedule *Schedule;
+ {
+ LOCK_SCHEDULES_READ;
+ Schedule = Schedules->GetSchedule(Channel);
+ }
currentChannel = Channel->Number();
if (Schedule && Schedule->Events()->First())
{
@@ -153,7 +158,6 @@ void cMenuSearchMain::PrepareSchedule(const cChannel *Channel)
// timeb tnow;
// ftime(&tnow);
// isyslog("duration epgs prepsched: %d (%d)", tnow.millitm - tstart.millitm + ((tnow.millitm - tstart.millitm<0)?1000:0), Count());
- }
}
if (shiftTime)
{
@@ -431,7 +435,10 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
state = osContinue;
break;
case kGreen:
- if (schedules)
+ {
+ LOCK_CHANNELS_READ;
+ LOCK_SCHEDULES_READ;
+ if (Schedules)
{
if (HasSubMenu() && !InWhatsOnMenu && !InFavoritesMenu)
{
@@ -448,7 +455,6 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
cMenuMyScheduleItem* Item = (cMenuMyScheduleItem *)Get(Current());
if (Item && Item->event)
{
- LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByChannelID(Item->event->ChannelID(), true, true);
if (channel)
ChannelNr = channel->Number();
@@ -462,12 +468,11 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
else
{
InWhatsOnMenu = true;
- return AddSubMenu(new cMenuWhatsOnSearch(schedules, ChannelNr));
+ return AddSubMenu(new cMenuWhatsOnSearch(Schedules, ChannelNr));
}
}
else
{
- LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByNumber(currentChannel-1,-1);
if (channel) {
@@ -481,8 +486,12 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
return osContinue;
}
}
+ }
case kYellow:
- if (schedules)
+ {
+ LOCK_CHANNELS_READ;
+ LOCK_SCHEDULES_READ;
+ if (Schedules)
{
if (HasSubMenu())
{
@@ -496,11 +505,10 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
{
cMenuWhatsOnSearch::currentShowMode = showNext;
InWhatsOnMenu = true;
- return AddSubMenu(new cMenuWhatsOnSearch(schedules, cMenuWhatsOnSearch::CurrentChannel()));
+ return AddSubMenu(new cMenuWhatsOnSearch(Schedules, cMenuWhatsOnSearch::CurrentChannel()));
}
else
{
- LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByNumber(currentChannel+1,1);
if (channel) {
PrepareSchedule(channel);
@@ -514,6 +522,7 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
}
}
break;
+ }
case kBlue:
if (HasSubMenu())
{
diff --git a/menu_main.h b/menu_main.h
index 845a1ef..96567a1 100644
--- a/menu_main.h
+++ b/menu_main.h
@@ -32,8 +32,6 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
class cMenuSearchMain : public cOsdMenu {
private:
int helpKeys;
- cSchedulesLock schedulesLock;
- const cSchedules *schedules;
int otherChannel;
int currentChannel;
eOSState Record(void);