1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a deadlock when moving a folder containing several recordings between different volumes

This commit is contained in:
Klaus Schmidinger 2017-12-04 13:07:39 +01:00
parent b5d8f68b87
commit b96277e28a
3 changed files with 14 additions and 8 deletions

View File

@ -3284,6 +3284,8 @@ Matthias Senzel <matthias.senzel@t-online.de>
for reporting a bug in drawing very long menu titles in the LCARS skin for reporting a bug in drawing very long menu titles in the LCARS skin
for reporting and helping to debug a crash when stopping VDR for reporting and helping to debug a crash when stopping VDR
for reporting a crash when moving a recording between different volumes 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
Marek Nazarko <mnazarko@gmail.com> Marek Nazarko <mnazarko@gmail.com>
for translating OSD texts to the Polish language for translating OSD texts to the Polish language

View File

@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History
a subdirectory. a subdirectory.
- SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details). - SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details).
2017-11-29: Version 2.3.9 2017-12-04: Version 2.3.9
- Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Italian OSD texts (thanks to Diego Pierotto).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
@ -9213,3 +9213,5 @@ Video Disk Recorder Revision History
- Fixed positioning the cursor in the Recordings menu when moving a recording between - Fixed positioning the cursor in the Recordings menu when moving a recording between
different volumes. different volumes.
- Added a note to PLUGINS.html about writing log messages in English. - Added a note to PLUGINS.html about writing log messages in English.
- Fixed a deadlock when moving a folder containing several recordings between
different volumes (reported by Matthias Senzel).

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: recording.c 4.11 2017/11/27 13:58:34 kls Exp $ * $Id: recording.c 4.12 2017/12/04 13:03:11 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -1857,7 +1857,7 @@ public:
int Usage(const char *FileName = NULL) const; int Usage(const char *FileName = NULL) const;
const char *FileNameSrc(void) const { return fileNameSrc; } const char *FileNameSrc(void) const { return fileNameSrc; }
const char *FileNameDst(void) const { return fileNameDst; } const char *FileNameDst(void) const { return fileNameDst; }
bool Active(bool &Error); bool Active(cRecordings *Recordings, bool &Error);
}; };
cRecordingsHandlerEntry::cRecordingsHandlerEntry(int Usage, const char *FileNameSrc, const char *FileNameDst) cRecordingsHandlerEntry::cRecordingsHandlerEntry(int Usage, const char *FileNameSrc, const char *FileNameDst)
@ -1887,7 +1887,7 @@ int cRecordingsHandlerEntry::Usage(const char *FileName) const
return u; return u;
} }
bool cRecordingsHandlerEntry::Active(bool &Error) bool cRecordingsHandlerEntry::Active(cRecordings *Recordings, bool &Error)
{ {
bool CopierFinishedOk = false; bool CopierFinishedOk = false;
// First test whether there is an ongoing operation: // First test whether there is an ongoing operation:
@ -1917,18 +1917,18 @@ bool cRecordingsHandlerEntry::Active(bool &Error)
copier->Start(); copier->Start();
} }
ClearPending(); ClearPending();
LOCK_RECORDINGS_WRITE; // to trigger a state change Recordings->SetModified(); // to trigger a state change
return true; return true;
} }
// Clean up: // Clean up:
if (CopierFinishedOk && (Usage() & ruMove) != 0) { if (CopierFinishedOk && (Usage() & ruMove) != 0) {
cRecording Recording(FileNameSrc()); cRecording Recording(FileNameSrc());
if (Recording.Delete()) { if (Recording.Delete()) {
LOCK_RECORDINGS_WRITE;
Recordings->DelByName(Recording.FileName()); Recordings->DelByName(Recording.FileName());
Recordings->SetModified(); // to trigger a state change
} }
} }
LOCK_RECORDINGS_WRITE; // to trigger a state change Recordings->SetModified(); // to trigger a state change
Recordings->TouchUpdate(); Recordings->TouchUpdate();
return false; return false;
} }
@ -1954,9 +1954,11 @@ void cRecordingsHandler::Action(void)
while (Running()) { while (Running()) {
bool Sleep = false; bool Sleep = false;
{ {
LOCK_RECORDINGS_WRITE;
Recordings->SetExplicitModify();
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
if (cRecordingsHandlerEntry *r = operations.First()) { if (cRecordingsHandlerEntry *r = operations.First()) {
if (!r->Active(error)) if (!r->Active(Recordings, error))
operations.Del(r); operations.Del(r);
else else
Sleep = true; Sleep = true;