]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virobject: Improve documentation
authorEric Blake <eblake@redhat.com>
Fri, 15 Mar 2019 04:14:41 +0000 (23:14 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 15 Mar 2019 13:30:47 +0000 (08:30 -0500)
commit632ac8f8e7202ad848d0fbe3c2ca7e228dee1cef
tree6cf7fd1c214d956f8788208f133632e4f336a2dd
parentc2bc419131b0ee6a652e1d722e2b34673405f5cc
virobject: Improve documentation

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).  I
also had to read the code to learn if a dispose method was even
mandatory (it is not, although getting NULL through VIR_CLASS_NEW
requires a macro).  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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/util/virobject.c
src/util/virobject.h