Modified cMenuTimers::Delete() to avoid a lengthy lock on the Timers list while prompting the user

This commit is contained in:
Klaus Schmidinger 2018-03-18 12:03:46 +01:00
parent 55408b73ca
commit a2b6b142d8
2 changed files with 20 additions and 20 deletions

View File

@ -9314,3 +9314,5 @@ Video Disk Recorder Revision History
- Fixed handling parameters in the S2SatelliteDeliverySystemDescriptor and - Fixed handling parameters in the S2SatelliteDeliverySystemDescriptor and
T2DeliverySystemDescriptor that were overwritten when parsing the T2DeliverySystemDescriptor that were overwritten when parsing the
SatelliteDeliverySystemDescriptor or TerrestrialDeliverySystemDescriptor, respectively. SatelliteDeliverySystemDescriptor or TerrestrialDeliverySystemDescriptor, respectively.
- Modified cMenuTimers::Delete() to avoid a lengthy lock on the Timers list while prompting
the user.

24
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 4.68 2018/03/09 15:02:29 kls Exp $ * $Id: menu.c 4.69 2018/03/18 12:01:09 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1344,22 +1344,17 @@ eOSState cMenuTimers::Delete(void)
// Check if this timer is active: // Check if this timer is active:
cTimer *Timer = GetTimer(); cTimer *Timer = GetTimer();
if (Timer) { if (Timer) {
if (Interface->Confirm(tr("Delete timer?"))) { bool TimerRecording = Timer->Recording();
if (Timer->Recording()) { timersStateKey.Remove(false); // must release lock while prompting!
if (Interface->Confirm(tr("Timer still recording - really delete?"))) { if (Interface->Confirm(tr("Delete timer?")) && (!TimerRecording || Interface->Confirm(tr("Timer still recording - really delete?")))) {
Timers = cTimers::GetTimersWrite(timersStateKey);
Timer = GetTimer();
if (Timer) {
if (!Timer->Remote()) { if (!Timer->Remote()) {
Timer->Skip(); Timer->Skip();
cRecordControls::Process(Timers, time(NULL)); cRecordControls::Process(Timers, time(NULL));
} }
} if (HandleRemoteModifications(NULL, Timer)) {
else
Timer = NULL;
}
if (Timer) {
if (!HandleRemoteModifications(NULL, Timer)) {
timersStateKey.Remove();
return osContinue;
}
if (Timer->Remote()) if (Timer->Remote())
Timers->SetSyncStateKey(StateKeySVDRPRemoteTimersPoll); Timers->SetSyncStateKey(StateKeySVDRPRemoteTimersPoll);
Timers->Del(Timer); Timers->Del(Timer);
@ -1368,6 +1363,9 @@ eOSState cMenuTimers::Delete(void)
} }
} }
} }
else
return osContinue;
}
timersStateKey.Remove(Timer != NULL); timersStateKey.Remove(Timer != NULL);
return osContinue; return osContinue;
} }