Hello!
> > static void object_property_del_all(Object *obj)
> > {
> > - while (!QTAILQ_EMPTY(&obj->properties)) {
> > - ObjectProperty *prop = QTAILQ_FIRST(&obj->properties);
> > -
> > - QTAILQ_REMOVE(&obj->properties, prop, node);
> > + ObjectProperty *prop;
> > + GHashTableIter iter;
> > + gpointer key, value;
> >
> > + g_hash_table_iter_init(&iter, obj->properties);
> > + while (g_hash_table_iter_next(&iter, &key, &value)) {
> > + prop = value;
> > if (prop->release) {
> > prop->release(obj, prop->name, prop->opaque);
> > }
>
> Why is this not in property_free(), too? Is there a timing difference?
This is what i started from, and got NAKed. property_free() gets only
ObjectProperty * as argument, but for our release callback we
need also 'obj'. In my first version i added Object * backpointer to
ObjectProperty and Daniel reported a problem with that:
--- cut ---
I have a patch which adds property registration against the
class, so requiring ObjectProperty to have a back-poointer
to an object instance is not desirable.
--- cut ---
Full message here:
https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg01999.html
>
> > -
> > - g_free(prop->name);
> > - g_free(prop->type);
> > - g_free(prop->description);
> > - g_free(prop);
> > }
> > +
> > + g_hash_table_unref(obj->properties);
> > }
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia