]> git.sesse.net Git - mlt/commitdiff
producer_pixbuf.c: bugfix (kdenlive-575) memory leak
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 27 Jan 2009 06:41:54 +0000 (06:41 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 27 Jan 2009 06:41:54 +0000 (06:41 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1327 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/gtk2/producer_pixbuf.c

index c56e91deb55ad62c2dd139244c63ff2ed968eed2..591631ce019eb878451359f9a8ec48a63120917f 100644 (file)
@@ -201,19 +201,21 @@ static void refresh_image( mlt_frame frame, int width, int height )
        // Obtain properties of producer
        mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
 
+       // Obtain the cache flag and structure
+       int use_cache = mlt_properties_get_int( producer_props, "cache" );
+       mlt_properties cache = mlt_properties_get_data( producer_props, "_cache", NULL );
+       int update_cache = 0;
+
        // Check if user wants us to reload the image
        if ( mlt_properties_get_int( producer_props, "force_reload" ) ) 
        {
                pixbuf = NULL;
+               if ( !use_cache && this->image )
+                       mlt_pool_release( this->image );
                this->image = NULL;
                mlt_properties_set_int( producer_props, "force_reload", 0 );
        }
 
-       // Obtain the cache flag and structure
-       int use_cache = mlt_properties_get_int( producer_props, "cache" );
-       mlt_properties cache = mlt_properties_get_data( producer_props, "_cache", NULL );
-       int update_cache = 0;
-
        // Get the time to live for each frame
        double ttl = mlt_properties_get_int( producer_props, "ttl" );
 
@@ -488,9 +490,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                // Ensure that we have a way to obtain the position in the get_image
                mlt_properties_set_position( properties, "pixbuf_position", mlt_producer_position( producer ) );
 
-               // Refresh the image
-               refresh_image( *frame, 0, 0 );
-
                // Set producer-specific frame properties
                mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( producer_properties, "progressive" ) );
                mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_properties, "aspect_ratio" ) );