diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2010-08-29 13:40:37 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2010-08-29 13:40:37 +0200 |
commit | 505574fa983b12ae872bb46f01c8782e3a15f5e1 (patch) | |
tree | 18f58253017feee55a4dda680d7518c3a5a8f3c4 /cutter.c | |
parent | 22a4f5a50431ae7ee0668f62c918c631dbb761fb (diff) | |
download | vdr-505574fa983b12ae872bb46f01c8782e3a15f5e1.tar.gz vdr-505574fa983b12ae872bb46f01c8782e3a15f5e1.tar.bz2 |
Added locking to the cCutter functions to avoid a crash in case CutRecording() is called from a plugin
Diffstat (limited to 'cutter.c')
-rw-r--r-- | cutter.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -4,13 +4,12 @@ * See the main source file 'vdr.c' for copyright information and * 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 "recording.h" #include "remux.h" -#include "thread.h" #include "videodir.h" // --- cCuttingThread -------------------------------------------------------- @@ -194,6 +193,7 @@ void cCuttingThread::Action(void) // --- cCutter --------------------------------------------------------------- +cMutex cCutter::mutex; char *cCutter::editedVersionName = NULL; cCuttingThread *cCutter::cuttingThread = NULL; bool cCutter::error = false; @@ -201,6 +201,7 @@ bool cCutter::ended = false; bool cCutter::Start(const char *FileName) { + cMutexLock MutexLock(&mutex); if (!cuttingThread) { error = false; ended = false; @@ -231,6 +232,7 @@ bool cCutter::Start(const char *FileName) void cCutter::Stop(void) { + cMutexLock MutexLock(&mutex); bool Interrupted = cuttingThread && cuttingThread->Active(); const char *Error = cuttingThread ? cuttingThread->Error() : NULL; delete cuttingThread; @@ -247,6 +249,7 @@ void cCutter::Stop(void) bool cCutter::Active(void) { + cMutexLock MutexLock(&mutex); if (cuttingThread) { if (cuttingThread->Active()) return true; @@ -263,6 +266,7 @@ bool cCutter::Active(void) bool cCutter::Error(void) { + cMutexLock MutexLock(&mutex); bool result = error; error = false; return result; @@ -270,6 +274,7 @@ bool cCutter::Error(void) bool cCutter::Ended(void) { + cMutexLock MutexLock(&mutex); bool result = ended; ended = false; return result; |