]> git.sesse.net Git - mlt/commitdiff
Do not immediately destroy all cache items on purge.
authorDan Dennedy <dan@dennedy.org>
Fri, 27 May 2011 03:45:30 +0000 (20:45 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 27 May 2011 03:45:30 +0000 (20:45 -0700)
This is behaving badly with the addition of mlt_service_cache_purge in
the avformat producer because there were frames in consumer buffers
holding references to cache items calling mlt_cache_item_close on
destruction.

src/framework/mlt_cache.c

index 549fd6455fd1ef84e4105316ed10dc1fb37b9db1..eba75f956af541af963f9ff6d3576adf6a21cea0 100644 (file)
@@ -265,33 +265,6 @@ void mlt_cache_purge( mlt_cache cache, void *object )
                }
                cache->count = j;
                cache->current = alt;
-
-               // Remove the object's data from the active list regardless of refcount
-               char key[19];
-               sprintf( key, "%p", object );
-               mlt_cache_item item = mlt_properties_get_data( cache->active, key, NULL );
-               if ( item && item->destructor )
-               {
-                       item->destructor( item->data );
-                       item->data = NULL;
-                       item->destructor = NULL;
-                       mlt_properties_set_data( cache->active, key, NULL, 0, NULL, NULL );
-               }
-
-               // Remove the object's items from the garbage collection regardless of refcount
-               i = mlt_properties_count( cache->garbage );
-               while ( i-- )
-               {
-                       item = mlt_properties_get_data_at( cache->garbage, i, NULL );
-                       if ( object == item->object && item->destructor )
-                       {
-                               sprintf( key, "%p", item->data );
-                               item->destructor( item->data );
-                               item->data = NULL;
-                               item->destructor = NULL;
-                               mlt_properties_set_data( cache->garbage, key, NULL, 0, NULL, NULL );
-                       }
-               }
        }
        pthread_mutex_unlock( &cache->mutex );
 }