]> 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:18:50 +0000 (06:18 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 27 Jan 2009 06:18:50 +0000 (06:18 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1326 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/gtk2/producer_pixbuf.c

index 091859749a632e269b5a00beb38b24c93fba17ac..c56e91deb55ad62c2dd139244c63ff2ed968eed2 100644 (file)
@@ -263,25 +263,10 @@ static void refresh_image( mlt_frame frame, int width, int height )
                if ( width != this->width || height != this->height )
                {
                        pixbuf = mlt_properties_get_data( producer_props, "_pixbuf", NULL );
-                       if ( !use_cache )
-                       {
-                               mlt_pool_release( this->image );
-                               mlt_pool_release( this->alpha );
-                       }
-                       this->image = NULL;
-                       this->alpha = NULL;
                }
        }
        else if ( pixbuf == NULL && ( this->image == NULL || image_idx != this->image_idx ) )
        {
-               if ( !use_cache )
-               {
-                       mlt_pool_release( this->image );
-                       mlt_pool_release( this->alpha );
-               }
-               this->image = NULL;
-               this->alpha = NULL;
-
                this->image_idx = image_idx;
                pixbuf = gdk_pixbuf_new_from_file( mlt_properties_get_value( this->filenames, image_idx ), &error );
 
@@ -324,12 +309,16 @@ static void refresh_image( mlt_frame frame, int width, int height )
                this->height = height;
                
                // Allocate/define image
+               if ( !use_cache && this->image )
+                       mlt_pool_release( this->image );
                this->image = mlt_pool_alloc( width * ( height + 1 ) * 2 );
 
                // Extract YUV422 and alpha
                if ( gdk_pixbuf_get_has_alpha( pixbuf ) )
                {
                        // Allocate the alpha mask
+                       if ( !use_cache && this->alpha )
+                               mlt_pool_release( this->alpha );
                        this->alpha = mlt_pool_alloc( this->width * this->height );
 
                        // Convert the image