vipsobject has floating refs

derive from GInitiallyUnused to get floating refs
This commit is contained in:
John Cupitt 2011-05-19 14:35:51 +01:00
parent efe1a19598
commit 77caf201f1
5 changed files with 18 additions and 12 deletions
libvips
arithmetic
deprecated
include/vips
iofuncs

@ -321,7 +321,7 @@ vips_add( VipsImage *in1, VipsImage *in2, ... )
int result;
VipsImage *out;
va_start( ap, out );
va_start( ap, in2 );
result = vips_call_split( "add", ap, in1, in2, &out );
va_end( ap );

@ -796,5 +796,15 @@ im__compile_programs( VipsVector *vectors[IM_BANDFMT_LAST] )
int
im_add( IMAGE *in1, IMAGE *in2, IMAGE *out )
{
return( vips_call( "add", in1, in2, out, NULL ) );
VipsImage *x;
if( vips_call( "add", in1, in2, &x, NULL ) )
return( -1 );
if( im_copy( x, out ) ) {
g_object_unref( x );
return( -1 );
}
g_object_unref( x );
return( 0 );
}

@ -180,7 +180,7 @@ void vips_argument_free_all( VipsObject *object );
(G_TYPE_INSTANCE_GET_CLASS( (obj), VIPS_TYPE_OBJECT, VipsObjectClass ))
struct _VipsObject {
GObject parent_object;
GInitiallyUnowned parent_object;
gboolean constructed; /* Construct done and checked */
@ -202,7 +202,7 @@ struct _VipsObject {
};
struct _VipsObjectClass {
GObjectClass parent_class;
GInitiallyUnownedClass parent_class;
/* Build the object ... all argument properties have been set,
* now build the thing.

@ -75,7 +75,7 @@ static GMutex *vips__object_all_lock = NULL;
static guint vips_object_signals[SIG_LAST] = { 0 };
G_DEFINE_ABSTRACT_TYPE( VipsObject, vips_object, G_TYPE_OBJECT );
G_DEFINE_ABSTRACT_TYPE( VipsObject, vips_object, G_TYPE_INITIALLY_UNOWNED );
void
vips_object_preclose( VipsObject *object )
@ -555,7 +555,7 @@ vips_object_set_object( VipsObject *object, GParamSpec *pspec,
/* Ref the argument.
*/
g_object_ref( *member );
g_object_ref_sink( *member );
}
else if( argument_class->flags & VIPS_ARGUMENT_OUTPUT ) {
#ifdef DEBUG_REF
@ -569,7 +569,7 @@ vips_object_set_object( VipsObject *object, GParamSpec *pspec,
/* The argument reffs us.
*/
g_object_ref( object );
g_object_ref_sink( object );
argument_instance->close_id =
g_signal_connect( *member, "close",
G_CALLBACK( vips_object_arg_close ),

@ -308,8 +308,6 @@ vips_operation_get_valist (VipsOperation * operation, va_list ap)
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS (object);
GSList *p;
if (flags & REQUIRED)
{
/* Extract output arguments. Can't use vips_argument_map here
* :-( because passing va_list by reference is not portable.
* So we have to copy-paste the vips_argument_map() loop.
@ -321,8 +319,6 @@ vips_operation_get_valist (VipsOperation * operation, va_list ap)
VipsArgumentClass *argument_class = (VipsArgumentClass *) p->data;
VipsArgument *argument = (VipsArgument *) argument_class;
GParamSpec *pspec = argument->pspec;
VipsArgumentInstance *argument_instance =
vips__argument_get_instance (argument_class, object);
/* We have many props on the arg table ... filter out the ones
* for this class.
@ -354,7 +350,7 @@ vips_operation_get_valist (VipsOperation * operation, va_list ap)
}
}
}
}
}
int