[vlmc-devel] commit: ClipWorkflow: Fix a crash when closing the project while rendering. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri Jun 11 14:02:32 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Jun 11 12:03:36 2010 +0200| [8a150de719640bd7fe88cb4ce22a25b71bfa09a2] | committer: Hugo Beauzée-Luyssen 

ClipWorkflow: Fix a crash when closing the project while rendering.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=8a150de719640bd7fe88cb4ce22a25b71bfa09a2
---

 src/Workflow/AudioClipWorkflow.cpp |    2 +-
 src/Workflow/AudioClipWorkflow.h   |    4 ++--
 src/Workflow/ClipWorkflow.cpp      |    1 +
 src/Workflow/ImageClipWorkflow.cpp |    5 +++++
 src/Workflow/ImageClipWorkflow.h   |    1 +
 src/Workflow/VideoClipWorkflow.cpp |    2 +-
 src/Workflow/VideoClipWorkflow.h   |    4 ++--
 7 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/Workflow/AudioClipWorkflow.cpp b/src/Workflow/AudioClipWorkflow.cpp
index 84204cb..4018e0a 100644
--- a/src/Workflow/AudioClipWorkflow.cpp
+++ b/src/Workflow/AudioClipWorkflow.cpp
@@ -34,7 +34,7 @@ AudioClipWorkflow::AudioClipWorkflow( ClipHelper *ch ) :
 
 AudioClipWorkflow::~AudioClipWorkflow()
 {
-    releasePrealocated();
+    stop();
 }
 
 void
diff --git a/src/Workflow/AudioClipWorkflow.h b/src/Workflow/AudioClipWorkflow.h
index 542622e..30e7ec5 100644
--- a/src/Workflow/AudioClipWorkflow.h
+++ b/src/Workflow/AudioClipWorkflow.h
@@ -57,9 +57,9 @@ class   AudioClipWorkflow : public ClipWorkflow
     protected:
         virtual quint32             getNbComputedBuffers() const;
         virtual quint32             getMaxComputedBuffers() const;
-        void                        flushComputedBuffers();
+        virtual void                flushComputedBuffers();
         void                        preallocate();
-        void                        releasePrealocated();
+        virtual void                releasePrealocated();
 
     private:
         void                        releaseBuffer( Workflow::AudioSample *sample );
diff --git a/src/Workflow/ClipWorkflow.cpp b/src/Workflow/ClipWorkflow.cpp
index 20a6870..51e30e0 100644
--- a/src/Workflow/ClipWorkflow.cpp
+++ b/src/Workflow/ClipWorkflow.cpp
@@ -49,6 +49,7 @@ ClipWorkflow::ClipWorkflow( ClipHelper* ch ) :
 
 ClipWorkflow::~ClipWorkflow()
 {
+    //Don't call stop() method from here, the Vtable is probably already gone.
     delete m_renderWaitCond;
     delete m_renderLock;
     delete m_initWaitCond;
diff --git a/src/Workflow/ImageClipWorkflow.cpp b/src/Workflow/ImageClipWorkflow.cpp
index 5311fba..064eb87 100644
--- a/src/Workflow/ImageClipWorkflow.cpp
+++ b/src/Workflow/ImageClipWorkflow.cpp
@@ -40,6 +40,11 @@ ImageClipWorkflow::ImageClipWorkflow( ClipHelper *ch ) :
              this, SLOT( stopComputation() ), Qt::QueuedConnection );
 }
 
+ImageClipWorkflow::~ImageClipWorkflow()
+{
+    stop();
+}
+
 void
 ImageClipWorkflow::initVlcOutput()
 {
diff --git a/src/Workflow/ImageClipWorkflow.h b/src/Workflow/ImageClipWorkflow.h
index 61a959c..15cecfd 100644
--- a/src/Workflow/ImageClipWorkflow.h
+++ b/src/Workflow/ImageClipWorkflow.h
@@ -38,6 +38,7 @@ class   ImageClipWorkflow : public ClipWorkflow
                 virtual void    release();
         };
         ImageClipWorkflow( ClipHelper* ch );
+        ~ImageClipWorkflow();
 
         void                    *getLockCallback() const;
         void                    *getUnlockCallback() const;
diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
index b3dc3b8..a3abcf6 100644
--- a/src/Workflow/VideoClipWorkflow.cpp
+++ b/src/Workflow/VideoClipWorkflow.cpp
@@ -39,7 +39,7 @@ VideoClipWorkflow::VideoClipWorkflow( ClipHelper *ch ) :
 
 VideoClipWorkflow::~VideoClipWorkflow()
 {
-    releasePrealocated();
+    stop();
 }
 
 void
diff --git a/src/Workflow/VideoClipWorkflow.h b/src/Workflow/VideoClipWorkflow.h
index e845a8c..9e1b84d 100644
--- a/src/Workflow/VideoClipWorkflow.h
+++ b/src/Workflow/VideoClipWorkflow.h
@@ -59,12 +59,12 @@ class   VideoClipWorkflow : public ClipWorkflow
         virtual quint32         getNbComputedBuffers() const;
         virtual quint32         getMaxComputedBuffers() const;
         void                    releaseBuffer( Workflow::Frame* frame );
-        void                    flushComputedBuffers();
+        virtual void            flushComputedBuffers();
         /**
          *  \brief              Pre-allocate some image buffers.
          */
         void                    preallocate();
-        void                    releasePrealocated();
+        virtual void            releasePrealocated();
 
     private:
         QQueue<Workflow::Frame*>    m_computedBuffers;



More information about the Vlmc-devel mailing list