From e85282d167e0e665fed1b2ab37040ba654d3b4e2 Mon Sep 17 00:00:00 2001 From: ddennedy Date: Tue, 10 Jun 2008 06:37:31 +0000 Subject: [PATCH] mlt_playlist.c: prevent segfault in mlt_playlist_virtual_refresh on closed producers - regression introduced in recent autoclose commit. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1140 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_playlist.c | 41 ++++++++++++++++++++++------------------- 1 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 084af24..0e0ba09 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -132,28 +132,31 @@ static int mlt_playlist_virtual_refresh( mlt_playlist this ) { // Get the producer mlt_producer producer = this->list[ i ]->producer; - int current_length = mlt_producer_get_out( producer ) - mlt_producer_get_in( producer ) + 1; - - // Check if the length of the producer has changed - if ( this->list[ i ]->frame_in != mlt_producer_get_in( producer ) || - this->list[ i ]->frame_out != mlt_producer_get_out( producer ) ) + if ( producer ) { - // This clip should be removed... - if ( current_length < 1 ) - { - this->list[ i ]->frame_in = 0; - this->list[ i ]->frame_out = -1; - this->list[ i ]->frame_count = 0; - } - else + int current_length = mlt_producer_get_out( producer ) - mlt_producer_get_in( producer ) + 1; + + // Check if the length of the producer has changed + if ( this->list[ i ]->frame_in != mlt_producer_get_in( producer ) || + this->list[ i ]->frame_out != mlt_producer_get_out( producer ) ) { - this->list[ i ]->frame_in = mlt_producer_get_in( producer ); - this->list[ i ]->frame_out = mlt_producer_get_out( producer ); - this->list[ i ]->frame_count = current_length; + // This clip should be removed... + if ( current_length < 1 ) + { + this->list[ i ]->frame_in = 0; + this->list[ i ]->frame_out = -1; + this->list[ i ]->frame_count = 0; + } + else + { + this->list[ i ]->frame_in = mlt_producer_get_in( producer ); + this->list[ i ]->frame_out = mlt_producer_get_out( producer ); + this->list[ i ]->frame_count = current_length; + } + + // Update the producer_length + this->list[ i ]->producer_length = current_length; } - - // Update the producer_length - this->list[ i ]->producer_length = current_length; } // Calculate the frame_count -- 1.7.4.4