]> git.sesse.net Git - mlt/commitdiff
Fix crash removing filter attached to a service.
authorDan Dennedy <dan@dennedy.org>
Thu, 24 Oct 2013 01:27:31 +0000 (18:27 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 24 Oct 2013 01:27:31 +0000 (18:27 -0700)
There can still be frame objects that have a filter's get_image function
in its image processing stack. Need to add a reference to the filter on
the frame objects.

src/framework/mlt_filter.c

index ed4d9192c32c43e8fe96f26ae053d699a9bcffb9..29be4a66dab0a3376be18c917dd6a7a7d33f79cc 100644 (file)
@@ -301,19 +301,30 @@ mlt_frame mlt_filter_process( mlt_filter self, mlt_frame frame )
        int disable = mlt_properties_get_int( properties, "disable" );
        const char *unique_id = mlt_properties_get( properties, "_unique_id" );
        mlt_position position = mlt_frame_get_position( frame );
-       char name[20];
+       char name[30];
 
        // Make the properties key from unique id
-       snprintf( name, 20, "pos.%s", unique_id );
-       name[20 -1] = '\0';
+       snprintf( name, sizeof(name), "pos.%s", unique_id );
+       name[sizeof(name) -1] = '\0';
 
        // Save the position on the frame
        mlt_properties_set_position( MLT_FRAME_PROPERTIES( frame ), name, position );
 
        if ( disable || self->process == NULL )
+       {
                return frame;
+       }
        else
+       {
+               // Add a reference to this filter on the frame
+               mlt_properties_inc_ref( MLT_FILTER_PROPERTIES(self) );
+               snprintf( name, sizeof(name), "filter.%s", unique_id );
+               name[sizeof(name) -1] = '\0';
+               mlt_properties_set_data( MLT_FRAME_PROPERTIES(frame), name, self, 0,
+                       (mlt_destructor) mlt_filter_close, NULL );
+
                return self->process( self, frame );
+       }
 }
 
 /** Get a frame from this filter.