From f0cd07ff71b9c9a48003501d47f1c192224193fa Mon Sep 17 00:00:00 2001 From: Timo Eskola Date: Wed, 5 Sep 2018 08:43:32 +0300 Subject: Fixed recordings locking sequence. --- HISTORY | 3 ++- menu.c | 38 ++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/HISTORY b/HISTORY index 76e17fe..8e5f989 100644 --- a/HISTORY +++ b/HISTORY @@ -1,12 +1,13 @@ VDR Plugin 'duplicates' Revision History ---------------------------------------- -2018-09-03: Version 0.2.2 +2018-09-05: Version 0.2.2 - Updated kNone handling in main menu. - Improved duplicate recording copy constructor. - Added missing recordings lock release. - Simplified toggle hidden. +- Fixed recordings locking sequence. 2018-08-30: Version 0.2.1 diff --git a/menu.c b/menu.c index 6e74a61..2836fc7 100644 --- a/menu.c +++ b/menu.c @@ -303,20 +303,6 @@ eOSState cMenuDuplicates::Delete(void) { if (Interface->Confirm(trVDR("Delete recording?"))) { if (TimerStillRecording(ri->FileName())) return osContinue; -#if VDRVERSNUM >= 20301 - cString FileName; - { - LOCK_RECORDINGS_READ - if (const cRecording *Recording = Recordings->GetByName(ri->FileName())) { - FileName = Recording->FileName(); - if (RecordingsHandler.GetUsage(FileName)) { - if (!Interface->Confirm(trVDR("Recording is being edited - really delete?"))) - return osContinue; - } - } - } - RecordingsHandler.Del(FileName); // must do this w/o holding a lock, because the cleanup section in cDirCopier::Action() might request one! -#else cString FileName = ri->FileName(); if (RecordingsHandler.GetUsage(FileName)) { if (Interface->Confirm(trVDR("Recording is being edited - really delete?"))) { @@ -324,7 +310,6 @@ eOSState cMenuDuplicates::Delete(void) { } else return osContinue; } -#endif if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), FileName) == 0) cControl::Shutdown(); #if VDRVERSNUM >= 20301 @@ -368,7 +353,8 @@ eOSState cMenuDuplicates::Play(void) { cMenuDuplicateItem *ri = (cMenuDuplicateItem *)Get(Current()); if (ri) { #if VDRVERSNUM >= 20301 - LOCK_RECORDINGS_READ; + cStateKey stateKey; + const cRecordings *Recordings = cRecordings::GetRecordingsRead(stateKey); const cRecording *recording = Recordings->GetByName(ri->FileName()); #else cRecording *recording = Recordings.GetByName(ri->FileName()); @@ -378,11 +364,18 @@ eOSState cMenuDuplicates::Play(void) { cDuplicatesReplayControl::SetRecording(recording->FileName()); #else cDuplicatesReplayControl::SetRecording(recording->FileName(), recording->Title()); +#endif +#if VDRVERSNUM >= 20301 + stateKey.Remove(); #endif cControl::Shutdown(); cControl::Launch(new cDuplicatesReplayControl); return osEnd; } +#if VDRVERSNUM >= 20301 + else + stateKey.Remove(); +#endif } return osContinue; } @@ -401,13 +394,22 @@ eOSState cMenuDuplicates::Info(void) { cMenuDuplicateItem *ri = (cMenuDuplicateItem *)Get(Current()); if (ri) { #if VDRVERSNUM >= 20301 - LOCK_RECORDINGS_READ; + cStateKey stateKey; + const cRecordings *Recordings = cRecordings::GetRecordingsRead(stateKey); const cRecording *recording = Recordings->GetByName(ri->FileName()); #else cRecording *recording = Recordings.GetByName(ri->FileName()); #endif - if (recording && recording->Info()->Title()) + if (recording && recording->Info()->Title()) { +#if VDRVERSNUM >= 20301 + stateKey.Remove(); +#endif return AddSubMenu(new cMenuDuplicate(recording)); + } +#if VDRVERSNUM >= 20301 + else + stateKey.Remove(); +#endif } return osContinue; } -- cgit v1.2.3