diff --git a/TODO b/TODO index cb43c9ee..1dd30685 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,11 @@ -- test the vfunc system for CLI args +- perhaps we should have hard refs everywhere? it's very confusing having a + mxture :-( use vips_object_local() to make hard refs autounref - vips_object_new_from_string() is now very confusingly named + + +- try out: + + http://incubator.quasimondo.com/processing/stackblur.pde diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 4917cdd6..bb9d04c3 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1048,7 +1048,7 @@ vips_object_set_argument_from_string( VipsObject *object, g_assert( argument_class->flags & VIPS_ARGUMENT_INPUT ); if( g_type_is_a( otype, VIPS_TYPE_OBJECT ) && - (oclass = g_type_class_peek( otype )) && + (oclass = g_type_class_ref( otype )) && oclass->new_from_string ) { VipsObject *object; @@ -1118,7 +1118,7 @@ vips_object_get_argument_needs_string( VipsObject *object, const char *name ) /* For now, only vipsobject subclasses can ask for args. */ if( g_type_is_a( otype, VIPS_TYPE_OBJECT ) && - (oclass = g_type_class_peek( otype )) ) + (oclass = g_type_class_ref( otype )) ) return( oclass->output_needs_arg ); return( FALSE ); @@ -1173,7 +1173,7 @@ vips_object_get_argument_to_string( VipsObject *object, g_assert( argument_class->flags & VIPS_ARGUMENT_OUTPUT ); if( g_type_is_a( otype, VIPS_TYPE_OBJECT ) && - (oclass = g_type_class_peek( otype )) && + (oclass = g_type_class_ref( otype )) && oclass->output_to_arg ) { VipsObject *value; @@ -1495,25 +1495,12 @@ vips_class_map_concrete_all( GType type, VipsClassMap fn, void *a ) void *result; result = NULL; - if( !G_TYPE_IS_ABSTRACT( type ) ) { - GTypeClass *class; - - /* Does this class exist? Try to create if not. + if( !G_TYPE_IS_ABSTRACT( type ) ) + /* We never unref this ref, but we never unload classes + * anyway, so so what. */ - if( !(class = g_type_class_peek( type )) ) - /* We don't unref, so the class is never finalized. - * This will make the peek work next time around and - * save us from constantly building and destroying - * classes. - */ - if( !(class = g_type_class_ref( type )) ) { - vips_error( "VipsObject", - "%s", _( "unable to build class" ) ); - return( NULL ); - } + result = fn( VIPS_OBJECT_CLASS( g_type_class_ref( type ) ), a ); - result = fn( VIPS_OBJECT_CLASS( class ), a ); - } if( !result ) result = vips_type_map( type, (VipsTypeMap2) vips_class_map_concrete_all, fn, a ); diff --git a/libvips/iofuncs/region.c b/libvips/iofuncs/region.c index 0eb144b4..af3ddbde 100644 --- a/libvips/iofuncs/region.c +++ b/libvips/iofuncs/region.c @@ -442,6 +442,10 @@ vips_region_new( VipsImage *image ) return( NULL ); } + /* We return a hard reference, so unfloat it. + */ + g_object_ref_sink( region ); + return( region ); }