On Wed, 15 Feb 2012 14:10:32 +0100
Juan Quintela <quint...@redhat.com> wrote:

> Luiz Capitulino <lcapitul...@redhat.com> wrote:
> > Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com>
> 
> 
> >  /**
> > + * qdict_copy(): Build a new dictionary from an existing one.
> > + */
> > +QDict *qdict_copy(const QDict *from)
> > +{
> > +    const QDictEntry *ent;
> > +    QDict *new;
> > +
> > +    new = qdict_new();
> > +
> > +    for (ent = qdict_first(from); ent; ent = qdict_next(from, ent)) {
> > +        qdict_put_obj(new, qdict_entry_key(ent), qdict_entry_value(ent));
> > +        qobject_incref(qdict_entry_value(ent));
> > +    }
> 
> 
> Without having any clue about how qobject refcounting works,  it looks
> suspicious that we first insert an object in a dict, and increase the
> ref counter after.  Shouldn't we do it the other way around?

I think this only matters for threaded applications. QDicts are not thread
safe, so this is not an issue but I'll drop this patch anyway (in favor of
increfing the error object).

Reply via email to