From c8682653974caa80c027b097d37f74a1a84022fe Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 5 Dec 2017 16:44:21 +0100 Subject: [PATCH] Fixed a lengthy write lock on the Recordings list in case of moving a folder with more than one recording --- CONTRIBUTORS | 2 ++ HISTORY | 4 +++- menu.c | 12 ++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4cf9e1ed..640fd58b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3286,6 +3286,8 @@ Matthias Senzel for reporting a crash when moving a recording between different volumes for reporting a deadlock when moving a folder containing several recordings between different volumes + for fixing a lengthy write lock on the Recordings list in case of moving a folder with + more than one recording Marek Nazarko for translating OSD texts to the Polish language diff --git a/HISTORY b/HISTORY index 1f7bd4f9..3dbdb129 100644 --- a/HISTORY +++ b/HISTORY @@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History a subdirectory. - SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details). -2017-12-04: Version 2.3.9 +2017-12-05: Version 2.3.9 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). @@ -9219,3 +9219,5 @@ Video Disk Recorder Revision History menu, in case there is a LastReplayed recording. - The CAM menu is now automatically closed when the current channel is switched (suggested by Dietmar Spingler). +- Fixed a lengthy write lock on the Recordings list in case of moving a folder with + more than one recording (thanks to Matthias Senzel). 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;