From c8682653974caa80c027b097d37f74a1a84022fe Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 5 Dec 2017 16:44:21 +0100 Subject: Fixed a lengthy write lock on the Recordings list in case of moving a folder with more than one recording --- menu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index c17a4f10..d857cbeb 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 4.48 2017/12/04 15:25:57 kls Exp $ + * $Id: menu.c 4.49 2017/12/05 16:39:57 kls Exp $ */ #include "menu.h" @@ -2479,11 +2479,15 @@ eOSState cMenuPathEdit::ApplyChanges(void) cString NewPath = *folder ? cString::sprintf("%s%c%s", folder, FOLDERDELIMCHAR, name) : name; NewPath.CompactChars(FOLDERDELIMCHAR); if (strcmp(NewPath, path)) { - LOCK_RECORDINGS_WRITE; - Recordings->SetExplicitModify(); - int NumRecordings = Recordings->GetNumRecordingsInPath(path); + int NumRecordings = 0; + { + LOCK_RECORDINGS_READ; + NumRecordings = Recordings->GetNumRecordingsInPath(path); + } if (NumRecordings > 1 && !Interface->Confirm(cString::sprintf(tr("Move entire folder containing %d recordings?"), NumRecordings))) return osContinue; + LOCK_RECORDINGS_WRITE; + Recordings->SetExplicitModify(); if (!Recordings->MoveRecordings(path, NewPath)) { Skins.Message(mtError, tr("Error while moving folder!")); return osContinue; -- cgit v1.2.3