summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorJasmin Jessich <jasmin@anw.at>2017-06-07 00:24:12 +0200
committerJasmin Jessich <jasmin@anw.at>2017-06-07 00:31:50 +0200
commitc60d14e39aa436c4f48d7b7ebbc1d31fee4f8bfd (patch)
tree526c27afc8dd1a855625feb1bd57aa3949824bc8 /pages
parent99cdbf4826724c4952c6cc89ab98bb3083ffb9ce (diff)
downloadvdr-plugin-live-c60d14e39aa436c4f48d7b7ebbc1d31fee4f8bfd.tar.gz
vdr-plugin-live-c60d14e39aa436c4f48d7b7ebbc1d31fee4f8bfd.tar.bz2
Fixed lock order in multischedule.ecpp and schedule.ecpp
- Move the lockings into some blocks and execute other modules with unlocked Channels and Schedules lists. This might not perfect, but there is currently no other solution possible.
Diffstat (limited to 'pages')
-rw-r--r--pages/multischedule.ecpp29
-rw-r--r--pages/schedule.ecpp18
2 files changed, 28 insertions, 19 deletions
diff --git a/pages/multischedule.ecpp b/pages/multischedule.ecpp
index 22a3f07..e82942b 100644
--- a/pages/multischedule.ecpp
+++ b/pages/multischedule.ecpp
@@ -46,9 +46,7 @@ std::vector<time_t> times_start;
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
pageTitle = tr("MultiSchedule");
-#if VDRVERSNUM >= 20301
- LOCK_CHANNELS_READ;
-#else
+#if VDRVERSNUM < 20301
ReadLock channelsLock( Channels );
if ( !channelsLock )
throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") );
@@ -62,6 +60,9 @@ std::vector<time_t> times_start;
if ( ( channel_groups_setting.compare(LiveSetup().GetChannelGroups()) != 0 ) || ( channel_groups_numbers.size() == 0 ) )
{
+#if VDRVERSNUM >= 20301
+ LOCK_CHANNELS_READ;
+#endif
// build the groups of channels to display
std::string channelGroups=LiveSetup().GetChannelGroups();
if ( channelGroups.empty() )
@@ -271,9 +272,7 @@ std::vector<time_t> times_start;
<& menu active=("multischedule") component=("multischedule.channel_selection") &>
<div class="inhalt">
<%cpp>
-#if VDRVERSNUM >= 20301
- LOCK_SCHEDULES_READ;
-#else
+#if VDRVERSNUM < 20301
cSchedulesLock schedulesLock;
cSchedules const* schedules = cSchedules::Schedules( schedulesLock );
#endif
@@ -305,14 +304,16 @@ std::vector<time_t> times_start;
for ( unsigned int j = 0; j<channel_groups_numbers[ channel ].size(); j++)
{
int prev_row = -1;
-
-
int chan = channel_groups_numbers[ channel ][ j ];
+ cChannel* Channel;
#if VDRVERSNUM >= 20301
- cChannel* Channel = (cChannel *)Channels->GetByNumber( chan );
+ {
+ LOCK_CHANNELS_READ;
+ Channel = (cChannel *)Channels->GetByNumber( chan );
+ }
#else
- cChannel* Channel = Channels.GetByNumber( chan );
+ Channel = Channels.GetByNumber( chan );
#endif
if ( ! Channel )
continue;
@@ -321,10 +322,14 @@ std::vector<time_t> times_start;
channel_names[ j ] = Channel->Name();
channel_IDs[ j ] = Channel->GetChannelID();
+ cSchedule const* Schedule;
#if VDRVERSNUM >= 20301
- cSchedule const* Schedule = Schedules->GetSchedule( (cChannel *)Channel );
+ {
+ LOCK_SCHEDULES_READ;
+ Schedule = Schedules->GetSchedule( Channel );
+ }
#else
- cSchedule const* Schedule = schedules->GetSchedule( Channel );
+ Schedule = schedules->GetSchedule( Channel );
#endif
if ( ! Schedule )
continue;
diff --git a/pages/schedule.ecpp b/pages/schedule.ecpp
index 71b62a0..7321f3c 100644
--- a/pages/schedule.ecpp
+++ b/pages/schedule.ecpp
@@ -25,10 +25,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
<%cpp>
pageTitle = trVDR("Schedule");
-#if VDRVERSNUM >= 20301
- // we lock here only the channels on purpose
- LOCK_CHANNELS_READ;
-#else
+#if VDRVERSNUM < 20301
cSchedulesLock schedulesLock;
cSchedules const* schedules = cSchedules::Schedules( schedulesLock );
@@ -40,12 +37,16 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
// cChannel* Channel; (see %request above)
if ( channel > 0 ) {
#if VDRVERSNUM >= 20301
+ LOCK_CHANNELS_READ;
Channel = (cChannel *)Channels->GetByNumber( channel );
#else
Channel = Channels.GetByNumber( channel );
#endif
}
else {
+#if VDRVERSNUM >= 20301
+ LOCK_CHANNELS_READ;
+#endif
if (cDevice::CurrentChannel()) {
#if VDRVERSNUM >= 20301
Channel = (cChannel *)Channels->GetByNumber(cDevice::CurrentChannel());
@@ -64,11 +65,14 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
if ( Channel == 0 )
throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") );
+ cSchedule const* Schedule;
#if VDRVERSNUM >= 20301
- LOCK_SCHEDULES_READ;
- cSchedule const* Schedule = Schedules->GetSchedule( (const cChannel *)Channel );
+ {
+ LOCK_SCHEDULES_READ;
+ Schedule = Schedules->GetSchedule( (const cChannel *)Channel );
+ }
#else
- cSchedule const* Schedule = schedules->GetSchedule( Channel );
+ Schedule = schedules->GetSchedule( Channel );
#endif
</%cpp>
<& pageelems.doc_type &>