]> git.sesse.net Git - mlt/commitdiff
consumer close fix
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 19 Jan 2005 13:51:42 +0000 (13:51 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 19 Jan 2005 13:51:42 +0000 (13:51 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@623 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_consumer.c

index 32c76680561a44741ed4b0d03e4493f6f712b560..29f248eed10825bf6de7dfab9871cac731f3ed1e 100644 (file)
@@ -639,22 +639,26 @@ void mlt_consumer_close( mlt_consumer this )
                // Get the childs close function
                void ( *consumer_close )( ) = this->close;
 
-               // Just in case...
-               mlt_consumer_stop( this );
-
-               // Make sure it only gets called once
-               this->close = NULL;
-               this->parent.close = NULL;
-
-               // Destroy the push mutex and condition
-               pthread_cond_broadcast( &this->put_cond );
-               pthread_mutex_destroy( &this->put_mutex );
-               pthread_cond_destroy( &this->put_cond );
+               if ( consumer_close )
+               {
+                       // Just in case...
+                       mlt_consumer_stop( this );
 
-               // Call the childs close if available
-               if ( consumer_close != NULL )
+                       this->close = NULL;
                        consumer_close( this );
+               }
                else
+               {
+
+                       // Make sure it only gets called once
+                       this->parent.close = NULL;
+
+                       // Destroy the push mutex and condition
+                       pthread_cond_broadcast( &this->put_cond );
+                       pthread_mutex_destroy( &this->put_mutex );
+                       pthread_cond_destroy( &this->put_cond );
+
                        mlt_service_close( &this->parent );
+               }
        }
 }