[libvirt] [PATCH] virobject: Improve documentation

Eric Blake eblake at redhat.com
Fri Mar 15 13:15:55 UTC 2019


On 3/15/19 2:40 AM, Erik Skultety wrote:
> On Thu, Mar 14, 2019 at 11:24:47PM -0500, Eric Blake wrote:
>> I had to inspect the code to learn whether a final virObjectUnref()
>> calls ALL dispose callbacks in child-to-parent order (akin to C++
>> destructors), or whether I manually had to call a parent-class dispose
>> when writing a child class dispose method.  The answer is the
>> former. (Thankfully, since VIR_FREE wipes out pointers for safety,
>> even if I had guessed wrong, I probably would not have tripped over a
>> double-free fault when the parent dispose ran for the second time).
>> While at it, the VIR_CLASS_NEW macro requires that the virObject
>> component at offset 0 be reached through the name 'parent', not
>> 'object'.
>>
>> Signed-off-by: Eric Blake <eblake at redhat.com>
>> ---
>>  src/util/virobject.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>

> I agree, but I also think that this would also be worth mentioning at
> virObjectUnref(), it currently says it will run the dispose callback associated
> with the object class, but one has to look at the code carefully to see it
> "climbs" up the chain through all the parents and disposes of everything.

Yep, will expand to cover that as well, and push. Thanks for the review.

> 
> Reviewed-by: Erik Skultety <eskultet at redhat.com>
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190315/64b92801/attachment-0001.sig>


More information about the libvir-list mailing list