Reverted 'Fixed a possible crash if an editing process is canceled while the edited recording is being replayed'

This commit is contained in:
Klaus Schmidinger 2023-02-15 14:01:20 +01:00
parent 42b584e38d
commit e0d87da768
2 changed files with 15 additions and 11 deletions

View File

@ -9833,7 +9833,7 @@ Video Disk Recorder Revision History
- Avoiding a zero sized array in cDevice::GetDevice() (thanks to Marko Mäkelä). - Avoiding a zero sized array in cDevice::GetDevice() (thanks to Marko Mäkelä).
- Now checking the video directory after setting the user id. - Now checking the video directory after setting the user id.
2022-12-26: 2023-02-15:
- Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Italian OSD texts (thanks to Diego Pierotto).
- Fixed restoring the volume at program start (thanks to Matthias Senzel). - Fixed restoring the volume at program start (thanks to Matthias Senzel).
@ -9843,3 +9843,6 @@ Video Disk Recorder Revision History
- Added a note to vdr.5 about event ids possibly changing when an event moves from - Added a note to vdr.5 about event ids possibly changing when an event moves from
one table to another. one table to another.
- Fixed initializing cDvbPlayerControl (was broken in version 2.6.3). - Fixed initializing cDvbPlayerControl (was broken in version 2.6.3).
- Reverted 'Fixed a possible crash if an editing process is canceled while the edited
recording is being replayed' (introduced in version 2.6.2), because it caused a
deadlock when moving recordings between volumes.

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 5.20 2022/12/01 12:47:33 kls Exp $ * $Id: recording.c 5.21 2023/02/15 14:01:20 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -1889,8 +1889,8 @@ public:
void SetCanceled(void) { usage |= ruCanceled; } void SetCanceled(void) { usage |= ruCanceled; }
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(void); bool Active(cRecordings *Recordings);
void Cleanup(void); void Cleanup(cRecordings *Recordings);
}; };
cRecordingsHandlerEntry::cRecordingsHandlerEntry(int Usage, const char *FileNameSrc, const char *FileNameDst) cRecordingsHandlerEntry::cRecordingsHandlerEntry(int Usage, const char *FileNameSrc, const char *FileNameDst)
@ -1921,7 +1921,7 @@ int cRecordingsHandlerEntry::Usage(const char *FileName) const
return u; return u;
} }
bool cRecordingsHandlerEntry::Active(void) bool cRecordingsHandlerEntry::Active(cRecordings *Recordings)
{ {
if ((usage & ruCanceled) != 0) if ((usage & ruCanceled) != 0)
return false; return false;
@ -1941,7 +1941,6 @@ bool cRecordingsHandlerEntry::Active(void)
copier = NULL; copier = NULL;
} }
// Now check if there is something to start: // Now check if there is something to start:
LOCK_RECORDINGS_WRITE;
if ((Usage() & ruPending) != 0) { if ((Usage() & ruPending) != 0) {
if ((Usage() & ruCut) != 0) { if ((Usage() & ruCut) != 0) {
cutter = new cCutter(FileNameSrc()); cutter = new cCutter(FileNameSrc());
@ -1954,6 +1953,7 @@ bool cRecordingsHandlerEntry::Active(void)
copier->Start(); copier->Start();
} }
ClearPending(); ClearPending();
Recordings->SetModified(); // to trigger a state change
return true; return true;
} }
// We're done: // We're done:
@ -1966,11 +1966,12 @@ bool cRecordingsHandlerEntry::Active(void)
Recordings->DelByName(Recording.FileName()); Recordings->DelByName(Recording.FileName());
} }
} }
Recordings->SetModified(); // to trigger a state change
Recordings->TouchUpdate(); Recordings->TouchUpdate();
return false; return false;
} }
void cRecordingsHandlerEntry::Cleanup(void) void cRecordingsHandlerEntry::Cleanup(cRecordings *Recordings)
{ {
if ((usage & ruCut)) { // this was a cut operation... if ((usage & ruCut)) { // this was a cut operation...
if (cutter // ...which had not yet ended... if (cutter // ...which had not yet ended...
@ -1979,7 +1980,6 @@ void cRecordingsHandlerEntry::Cleanup(void)
delete cutter; delete cutter;
cutter = NULL; cutter = NULL;
} }
LOCK_RECORDINGS_WRITE;
cVideoDirectory::RemoveVideoFile(fileNameDst); cVideoDirectory::RemoveVideoFile(fileNameDst);
Recordings->DelByName(fileNameDst); Recordings->DelByName(fileNameDst);
} }
@ -1992,7 +1992,6 @@ void cRecordingsHandlerEntry::Cleanup(void)
delete copier; delete copier;
copier = NULL; copier = NULL;
} }
LOCK_RECORDINGS_WRITE;
cVideoDirectory::RemoveVideoFile(fileNameDst); cVideoDirectory::RemoveVideoFile(fileNameDst);
if ((usage & ruMove) != 0) if ((usage & ruMove) != 0)
Recordings->AddByName(fileNameSrc); Recordings->AddByName(fileNameSrc);
@ -2021,11 +2020,13 @@ 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()) { if (!r->Active(Recordings)) {
error |= r->Error(); error |= r->Error();
r->Cleanup(); r->Cleanup(Recordings);
operations.Del(r); operations.Del(r);
} }
else else