On 01/14/2013 03:26 AM, Daniel P. Berrange wrote:
>
> ...but this doesn't unlock anything. You may want to document that the
> user is required to unlock the object before losing the last reference.
So this isn't an issue, though we ought to document locking rules
I guess.
Thanks for correcting me - you are right that there is no issue except
missing documentation.
> Is it worth a sanity check that anyobj is actually an object of
the
> right class, before we blindly dereference something wrong due to a
> coding error?
>
Possibily, though what action should we take. These methods really
need to be void, because it is not practical to check return values
everywhere. Meanwhile we don't like to abort(). So that leaves the
possibility of a VIR_WARN ?
Yep, a VIR_WARN in the logs is about the best we can do; but thankfully
the problem is most likely to hit during early development patches, when
someone is more likely to be paying attention to the logs.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org