Fixed a crash when deleting a recording that is currently being edited, and then immediately deleting the edited version, too

This commit is contained in:
Klaus Schmidinger 2024-08-30 20:43:26 +02:00
parent 71b0140003
commit 1df138d876
4 changed files with 15 additions and 4 deletions

View File

@ -2210,6 +2210,8 @@ Marko M
for avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there for avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there
are no areas are no areas
for avoiding a zero sized array in cDevice::GetDevice() for avoiding a zero sized array in cDevice::GetDevice()
for reporting a crash when deleting a recording that is currently being edited, and
then immediately deleting the edited version, too
Patrick Rother <krd-vdr@gulu.net> Patrick Rother <krd-vdr@gulu.net>
for reporting a bug in defining timers that only differ in the day of week for reporting a bug in defining timers that only differ in the day of week

View File

@ -9976,3 +9976,5 @@ Video Disk Recorder Revision History
an MPEG decoder. an MPEG decoder.
- The new SVDRP command 'AUDI' can be used to list the currently available audio tracks - The new SVDRP command 'AUDI' can be used to list the currently available audio tracks
and select one of them. and select one of them.
- Fixed a crash when deleting a recording that is currently being edited, and then
immediately deleting the edited version, too (reported by Marko Mäkelä).

5
menu.c
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: menu.c 5.15 2024/08/30 09:55:15 kls Exp $ * $Id: menu.c 5.16 2024/08/30 20:43:26 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -3290,8 +3290,11 @@ eOSState cMenuRecordings::Delete(void)
if (RecordingsHandler.GetUsage(FileName)) { if (RecordingsHandler.GetUsage(FileName)) {
if (!Interface->Confirm(tr("Recording is being edited - really delete?"))) if (!Interface->Confirm(tr("Recording is being edited - really delete?")))
return osContinue; return osContinue;
SetNeedsFastResponse(true); // makes sure the edited version is removed from the menu ASAP
} }
} }
else
return osContinue; // recording has already been deleted
} }
RecordingsHandler.Del(FileName); // must do this w/o holding a lock, because the cleanup section in cDirCopier::Action() might request one! RecordingsHandler.Del(FileName); // must do this w/o holding a lock, because the cleanup section in cDirCopier::Action() might request one!
if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), FileName) == 0) if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), FileName) == 0)

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.28 2024/06/13 09:31:11 kls Exp $ * $Id: recording.c 5.29 2024/08/30 20:43:26 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -2078,8 +2078,10 @@ void cRecordingsHandlerEntry::Cleanup(cRecordings *Recordings)
delete cutter; delete cutter;
cutter = NULL; cutter = NULL;
} }
cVideoDirectory::RemoveVideoFile(fileNameDst); if (cRecording *Recording = Recordings->GetByName(fileNameDst))
Recording->Delete();
Recordings->DelByName(fileNameDst); Recordings->DelByName(fileNameDst);
Recordings->SetModified();
} }
} }
if ((usage & (ruMove | ruCopy)) // this was a move/copy operation... if ((usage & (ruMove | ruCopy)) // this was a move/copy operation...
@ -2090,10 +2092,12 @@ void cRecordingsHandlerEntry::Cleanup(cRecordings *Recordings)
delete copier; delete copier;
copier = NULL; copier = NULL;
} }
cVideoDirectory::RemoveVideoFile(fileNameDst); if (cRecording *Recording = Recordings->GetByName(fileNameDst))
Recording->Delete();
if ((usage & ruMove) != 0) if ((usage & ruMove) != 0)
Recordings->AddByName(fileNameSrc); Recordings->AddByName(fileNameSrc);
Recordings->DelByName(fileNameDst); Recordings->DelByName(fileNameDst);
Recordings->SetModified();
} }
} }