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

Added locking to the cCutter functions to avoid a crash in case CutRecording() is called from a plugin

This commit is contained in:
Klaus Schmidinger 2010-08-29 13:40:37 +02:00
parent 22a4f5a504
commit 505574fa98
4 changed files with 15 additions and 4 deletions

View File

@ -984,6 +984,7 @@ Andreas Mair <andreas@vdr-developer.org>
option ':groups' is given option ':groups' is given
for fixing handling 3 and 4 byte UTF-8 symbols in Utf8CharGet() for fixing handling 3 and 4 byte UTF-8 symbols in Utf8CharGet()
for fixing initializing the timer's flags in the cTimer copy constructor for fixing initializing the timer's flags in the cTimer copy constructor
for reporting a crash in case CutRecording() is called from a plugin
Olivier Jacques <jacquesolivier@hotmail.com>) Olivier Jacques <jacquesolivier@hotmail.com>)
for translating OSD texts to the French language for translating OSD texts to the French language

View File

@ -6465,7 +6465,7 @@ Video Disk Recorder Revision History
the number keys can be used to enter characters in a text input field (suggested the number keys can be used to enter characters in a text input field (suggested
by Stefan Huskamp). by Stefan Huskamp).
2010-06-13: Version 1.7.16 2010-08-29: Version 1.7.16
- Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Italian OSD texts (thanks to Diego Pierotto).
- Added missing Dtypes for ATSC (thanks to Alex Lasnier). - Added missing Dtypes for ATSC (thanks to Alex Lasnier).
@ -6474,3 +6474,5 @@ Video Disk Recorder Revision History
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed the array size of Atypes in cPatFilter::Process() (thanks to - Fixed the array size of Atypes in cPatFilter::Process() (thanks to
Rolf Ahrenberg). Rolf Ahrenberg).
- Added locking to the cCutter functions to avoid a crash in case CutRecording()
is called from a plugin (reported by Andreas Mair).

View File

@ -4,13 +4,12 @@
* 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: cutter.c 2.4 2010/01/02 13:08:08 kls Exp $ * $Id: cutter.c 2.5 2010/08/29 13:35:18 kls Exp $
*/ */
#include "cutter.h" #include "cutter.h"
#include "recording.h" #include "recording.h"
#include "remux.h" #include "remux.h"
#include "thread.h"
#include "videodir.h" #include "videodir.h"
// --- cCuttingThread -------------------------------------------------------- // --- cCuttingThread --------------------------------------------------------
@ -194,6 +193,7 @@ void cCuttingThread::Action(void)
// --- cCutter --------------------------------------------------------------- // --- cCutter ---------------------------------------------------------------
cMutex cCutter::mutex;
char *cCutter::editedVersionName = NULL; char *cCutter::editedVersionName = NULL;
cCuttingThread *cCutter::cuttingThread = NULL; cCuttingThread *cCutter::cuttingThread = NULL;
bool cCutter::error = false; bool cCutter::error = false;
@ -201,6 +201,7 @@ bool cCutter::ended = false;
bool cCutter::Start(const char *FileName) bool cCutter::Start(const char *FileName)
{ {
cMutexLock MutexLock(&mutex);
if (!cuttingThread) { if (!cuttingThread) {
error = false; error = false;
ended = false; ended = false;
@ -231,6 +232,7 @@ bool cCutter::Start(const char *FileName)
void cCutter::Stop(void) void cCutter::Stop(void)
{ {
cMutexLock MutexLock(&mutex);
bool Interrupted = cuttingThread && cuttingThread->Active(); bool Interrupted = cuttingThread && cuttingThread->Active();
const char *Error = cuttingThread ? cuttingThread->Error() : NULL; const char *Error = cuttingThread ? cuttingThread->Error() : NULL;
delete cuttingThread; delete cuttingThread;
@ -247,6 +249,7 @@ void cCutter::Stop(void)
bool cCutter::Active(void) bool cCutter::Active(void)
{ {
cMutexLock MutexLock(&mutex);
if (cuttingThread) { if (cuttingThread) {
if (cuttingThread->Active()) if (cuttingThread->Active())
return true; return true;
@ -263,6 +266,7 @@ bool cCutter::Active(void)
bool cCutter::Error(void) bool cCutter::Error(void)
{ {
cMutexLock MutexLock(&mutex);
bool result = error; bool result = error;
error = false; error = false;
return result; return result;
@ -270,6 +274,7 @@ bool cCutter::Error(void)
bool cCutter::Ended(void) bool cCutter::Ended(void)
{ {
cMutexLock MutexLock(&mutex);
bool result = ended; bool result = ended;
ended = false; ended = false;
return result; return result;

View File

@ -4,16 +4,19 @@
* 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: cutter.h 2.1 2010/01/02 12:09:54 kls Exp $ * $Id: cutter.h 2.2 2010/08/29 13:32:33 kls Exp $
*/ */
#ifndef __CUTTER_H #ifndef __CUTTER_H
#define __CUTTER_H #define __CUTTER_H
#include "thread.h"
class cCuttingThread; class cCuttingThread;
class cCutter { class cCutter {
private: private:
static cMutex mutex;
static char *editedVersionName; static char *editedVersionName;
static cCuttingThread *cuttingThread; static cCuttingThread *cuttingThread;
static bool error; static bool error;