Am 13.06.2012 12:42, schrieb Paolo Bonzini: > Il 13/06/2012 12:28, Andreas Färber ha scritto: >> I am pretty certain that object_new() is NOT called recursively! > > It is for interfaces: > > object_new > ->object_new_with_type > ->object_initialize_with_type > ->object_init_with_type > ->object_interface_init > > and then: > > static void object_interface_init(Object *obj, InterfaceImpl *iface) > { > TypeImpl *ti = iface->type; > Interface *iface_obj; > > assert(!object_is_interface(obj)); > iface_obj = INTERFACE(object_new(ti->name)); > iface_obj->iface_obj = obj; > iface_obj->iface_parent.interfaces = INTERFACE_MAGIC; > > obj->interfaces = g_slist_prepend(obj->interfaces, iface_obj); > }
Ouch! One can argue that's still not recursive, but what matters more this borks Anthony's in-place object_initialize() concept. Two solutions come to mind: * allocate the interfaces as part of object_new() beyond instance_size * let initialize stage return Error* I'm starting to tend towards the latter since that also addresses failure to add properties. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg