From 6bef17cdecfc0f195409df6778cfa79293e9962c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 15 Feb 2008 16:13:10 +0100 Subject: [PATCH] When deleting the recording that is currently replayed, the replay is now stopped immediately --- CONTRIBUTORS | 4 ++++ HISTORY | 3 +++ menu.c | 4 +++- recording.c | 12 +++++++----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a9f9f5c0..16fa7cc9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2288,3 +2288,7 @@ Winfried Koehler Hans-Werner Hilse for adding the command line option --userdump to enable core dumps in case VDR is run as root with option -u + +Mikko Matilainen + for reporting a possible crash if the Info key is pressed after deleting the + currently replayed recording diff --git a/HISTORY b/HISTORY index 56740ac3..d4a293cd 100644 --- a/HISTORY +++ b/HISTORY @@ -5620,3 +5620,6 @@ Video Disk Recorder Revision History for pointing out a possible problem if the return value is not checked). Plugin authors may want to consider doing the same. For convenience there is now an additional version of cString::sprintf() that accepts a va_list parameter. +- When deleting the recording that is currently replayed, the replay is now + stopped immediately (thanks to Mikko Matilainen for reporting a possible crash + if the Info key is pressed after deleting the currently replayed recording). diff --git a/menu.c b/menu.c index c00dc667..486eedb5 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 1.474 2008/02/10 16:02:02 kls Exp $ + * $Id: menu.c 1.475 2008/02/15 16:06:56 kls Exp $ */ #include "menu.h" @@ -2084,6 +2084,8 @@ eOSState cMenuRecordings::Delete(void) } cRecording *recording = GetRecording(ri); if (recording) { + if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), ri->FileName()) == 0) + cControl::Shutdown(); if (recording->Delete()) { cReplayControl::ClearLastReplayed(ri->FileName()); Recordings.DelByName(ri->FileName()); diff --git a/recording.c b/recording.c index 096e0f85..894757c7 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.159 2008/02/10 21:57:09 kls Exp $ + * $Id: recording.c 1.160 2008/02/15 15:50:06 kls Exp $ */ #include "recording.h" @@ -987,10 +987,12 @@ bool cRecordings::Update(bool Wait) cRecording *cRecordings::GetByName(const char *FileName) { - for (cRecording *recording = First(); recording; recording = Next(recording)) { - if (strcmp(recording->FileName(), FileName) == 0) - return recording; - } + if (FileName) { + for (cRecording *recording = First(); recording; recording = Next(recording)) { + if (strcmp(recording->FileName(), FileName) == 0) + return recording; + } + } return NULL; }