more fixups to pass testsuite

This commit is contained in:
John Cupitt 2014-06-12 14:23:53 +01:00
parent d7bad8fd5b
commit 40e8025a55

View File

@ -464,10 +464,12 @@ vips__cache_init( void )
static void * static void *
vips_cache_print_fn( void *value, void *a, void *b ) vips_cache_print_fn( void *value, void *a, void *b )
{ {
VipsOperationCacheEntry *entry = value;
char str[32768]; char str[32768];
VipsBuf buf = VIPS_BUF_STATIC( str ); VipsBuf buf = VIPS_BUF_STATIC( str );
vips_object_to_string( VIPS_OBJECT( value ), &buf ); vips_object_to_string( VIPS_OBJECT( entry->operation ), &buf );
printf( "%p - %s\n", value, vips_buf_all( &buf ) ); printf( "%p - %s\n", value, vips_buf_all( &buf ) );
@ -539,13 +541,14 @@ vips_cache_remove( VipsOperation *operation )
g_assert( entry ); g_assert( entry );
g_hash_table_remove( vips_cache_table, operation );
vips_cache_unref( operation );
if( entry->invalidate_id ) { if( entry->invalidate_id ) {
g_signal_handler_disconnect( operation, entry->invalidate_id ); g_signal_handler_disconnect( operation, entry->invalidate_id );
entry->invalidate_id = 0; entry->invalidate_id = 0;
} }
g_hash_table_remove( vips_cache_table, operation );
vips_cache_unref( operation );
g_free( entry ); g_free( entry );
} }
@ -626,10 +629,13 @@ vips_cache_get_first_fn( void *value, void *a, void *b )
static VipsOperation * static VipsOperation *
vips_cache_get_first( void ) vips_cache_get_first( void )
{ {
if( vips_cache_table ) VipsOperationCacheEntry *entry;
return( VIPS_OPERATION( vips_hash_table_map( vips_cache_table,
vips_cache_get_first_fn, NULL, NULL ) ) ); if( vips_cache_table &&
else (entry = vips_hash_table_map( vips_cache_table,
vips_cache_get_first_fn, NULL, NULL )) )
return( VIPS_OPERATION( entry->operation ) );
return( NULL ); return( NULL );
} }