From 122c390c7bb24a8e669086944d5fce93136ed4a4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 11 Oct 2011 21:09:39 +0100 Subject: [PATCH] vips_class_map_all() was broken --- ChangeLog | 1 + libvips/iofuncs/object.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a46692a..bb2890d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - fallback vips_init() - im_openout() compat stub was wrong, breaking ruby-vips - vips_class_map_concrete_all() needed a compat macro too +- vips_class_map_all() was broken 10/8/11 started 7.26.3 - don't use G_VALUE_COLLECT_INIT(), many platforms do not have a glib this diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 42e62764..137c3349 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1598,14 +1598,22 @@ vips_class_map_all( GType type, VipsClassMap fn, void *a ) { void *result; - /* We never unref this ref, but we never unload classes - * anyway, so so what. + /* We can't instantiate abstract classes. */ - if( !(result = fn( VIPS_OBJECT_CLASS( g_type_class_ref( type ) ), a )) ) - result = vips_type_map( type, - (VipsTypeMap2) vips_class_map_all, fn, a ); + if( !G_TYPE_IS_ABSTRACT( type ) ) { + /* We never unref this ref, but we never unload classes + * anyway, so so what. + */ + if( (result = fn( + VIPS_OBJECT_CLASS( g_type_class_ref( type ) ), a )) ) + return( result ); + } - return( result ); + if( (result = vips_type_map( type, + (VipsTypeMap2) vips_class_map_all, fn, a )) ) + return( result ); + + return( NULL ); } /* How deeply nested is a class ... used to indent class lists.