Re: [PATCH] virobject: Improve documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
>> ---
>>  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@xxxxxxxxxx>
> 

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux