From 9fc55c30111dce52e8efb4065f9b9a97e0a61ca5 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 1 Jan 2012 21:54:30 +0000 Subject: [PATCH] fix a segv with old-style interpolate CLI args thanks Nicolas --- TODO | 13 ------------- libvips/deprecated/dispatch_types.c | 7 +++++-- libvips/iofuncs/object.c | 5 +++-- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 1af76e76..9500e6c0 100644 --- a/TODO +++ b/TODO @@ -2,25 +2,12 @@ - - -- try: - - $ vips im_affinei original.png vipsnohalo.png nohalo 4 0 0 4 1.5 1.5 0 0 1600 1200 - Segmentation fault - - in master - - - - - look at libpeas for plugin support http://live.gnome.org/Libpeas - - foreign docs come up as "VipsForeignSave", annoying, why? - we can no longer have round brackets in filenames, argh diff --git a/libvips/deprecated/dispatch_types.c b/libvips/deprecated/dispatch_types.c index 9e7e17e2..82447244 100644 --- a/libvips/deprecated/dispatch_types.c +++ b/libvips/deprecated/dispatch_types.c @@ -870,10 +870,13 @@ im_type_desc im__output_gvalue = { static int input_interpolate_init( im_object *obj, char *str ) { - VipsObjectClass *interpolate_class; + GType type = g_type_from_name( "VipsInterpolate" ); + VipsObjectClass *interpolate_class = + VIPS_INTERPOLATE_CLASS( g_type_class_ref( type ) ); VipsObject *object; - interpolate_class = vips_class_find( "VipsInterpolate", "interpolate" ); + g_assert( interpolate_class ); + if( !(object = vips_object_new_from_string( interpolate_class, str )) ) return( -1 ); if( vips_object_build( object ) ) { diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index c94ff8da..77cf6573 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1680,6 +1680,7 @@ vips_object_new_from_string( VipsObjectClass *object_class, const char *p ) VipsObject *object; VipsToken token; + g_assert( object_class ); g_assert( object_class->new_from_string ); /* The first string in p is the main construct arg, eg. a filename. @@ -1893,14 +1894,14 @@ vips_type_map_all( GType base, VipsTypeMapFn fn, void *a ) /** * vips_class_map_all: (skip) * - * Loop over all the subclasses of a base type. Non-abtract classes only. + * Loop over all the subclasses of a base type. Non-abstract classes only. */ void * vips_class_map_all( GType type, VipsClassMapFn fn, void *a ) { void *result; - /* We can't instantiate abstract classes. + /* Avoid abstract classes. Use type_map_all for them. */ if( !G_TYPE_IS_ABSTRACT( type ) ) { /* We never unref this ref, but we never unload classes