summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-12-05 16:44:21 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2017-12-05 16:44:21 +0100
commitc8682653974caa80c027b097d37f74a1a84022fe (patch)
tree109cee9106c08329a278ffd2d8585b360f125764 /menu.c
parente5e0315d3490511ccaa6c7e0d456cffbd7d773fb (diff)
downloadvdr-c8682653974caa80c027b097d37f74a1a84022fe.tar.gz
vdr-c8682653974caa80c027b097d37f74a1a84022fe.tar.bz2
Fixed a lengthy write lock on the Recordings list in case of moving a folder with more than one recording
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c12
1 files changed, 8 insertions, 4 deletions
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;