qom/object.c: Reset interface list on inheritance

The QOM framework will attempt the recreate a classes interface list from
scratch for each class. This means that a child class should zero out the
list of interfaces when cloned from the parent class.

Currently the list is memcpy()d from the parent to the child. As the interface
list is just a pointer to a list, this means the parent and child will share
the same list of interfaces. When the child inits, it will append its own
interfaces to the parents list. This is incorrect as the parent should not pick
up its childs interfaces.

This actually causes an infinite loop at class init time, as the child will
iterate through the parent interface list adding each itf to its own list(in
type_initialize()). As the list is (erroneously) shared, the new interface
instances for the child are appended to the parent, and the iterator never hits
the tail and loops forever.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1f58d2b629d82865dbb2fd5ba8445854049c4382.1361246206.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
1 file changed
tree: a9dfbad3f85b5870769016fc4662119fe4af2d98
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. disas/
  7. docs/
  8. fpu/
  9. fsdev/
  10. gdb-xml/
  11. hw/
  12. include/
  13. ldscripts/
  14. libcacard/
  15. linux-headers/
  16. linux-user/
  17. net/
  18. pc-bios/
  19. qapi/
  20. qga/
  21. QMP/
  22. qobject/
  23. qom/
  24. roms/
  25. scripts/
  26. slirp/
  27. stubs/
  28. sysconfigs/
  29. target-alpha/
  30. target-arm/
  31. target-cris/
  32. target-i386/
  33. target-lm32/
  34. target-m68k/
  35. target-microblaze/
  36. target-mips/
  37. target-openrisc/
  38. target-ppc/
  39. target-s390x/
  40. target-sh4/
  41. target-sparc/
  42. target-unicore32/
  43. target-xtensa/
  44. tcg/
  45. tests/
  46. trace/
  47. ui/
  48. util/
  49. .exrc
  50. .gitignore
  51. .gitmodules
  52. .mailmap
  53. aio-posix.c
  54. aio-win32.c
  55. arch_init.c
  56. async.c
  57. balloon.c
  58. block-migration.c
  59. block.c
  60. blockdev-nbd.c
  61. blockdev.c
  62. blockjob.c
  63. bt-host.c
  64. bt-vhci.c
  65. Changelog
  66. cmd.c
  67. cmd.h
  68. CODING_STYLE
  69. configure
  70. COPYING
  71. COPYING.LIB
  72. coroutine-gthread.c
  73. coroutine-sigaltstack.c
  74. coroutine-ucontext.c
  75. coroutine-win32.c
  76. cpu-exec.c
  77. cpus.c
  78. cputlb.c
  79. device_tree.c
  80. disas.c
  81. dma-helpers.c
  82. dump-stub.c
  83. dump.c
  84. exec.c
  85. gdbstub.c
  86. HACKING
  87. hmp-commands.hx
  88. hmp.c
  89. hmp.h
  90. iohandler.c
  91. ioport.c
  92. kvm-all.c
  93. kvm-stub.c
  94. LICENSE
  95. main-loop.c
  96. MAINTAINERS
  97. Makefile
  98. Makefile.objs
  99. Makefile.target
  100. memory.c
  101. memory_mapping-stub.c
  102. memory_mapping.c
  103. migration-exec.c
  104. migration-fd.c
  105. migration-tcp.c
  106. migration-unix.c
  107. migration.c
  108. monitor.c
  109. nbd.c
  110. os-posix.c
  111. os-win32.c
  112. page_cache.c
  113. qapi-schema-test.json
  114. qapi-schema.json
  115. qdict-test-data.txt
  116. qemu-bridge-helper.c
  117. qemu-char.c
  118. qemu-coroutine-io.c
  119. qemu-coroutine-lock.c
  120. qemu-coroutine-sleep.c
  121. qemu-coroutine.c
  122. qemu-doc.texi
  123. qemu-img-cmds.hx
  124. qemu-img.c
  125. qemu-img.texi
  126. qemu-io.c
  127. qemu-log.c
  128. qemu-nbd.c
  129. qemu-nbd.texi
  130. qemu-options-wrapper.h
  131. qemu-options.h
  132. qemu-options.hx
  133. qemu-seccomp.c
  134. qemu-tech.texi
  135. qemu-timer.c
  136. qemu.sasl
  137. qmp-commands.hx
  138. qmp.c
  139. qtest.c
  140. readline.c
  141. README
  142. rules.mak
  143. savevm.c
  144. spice-qemu-char.c
  145. tcg-runtime.c
  146. tci.c
  147. thread-pool.c
  148. thunk.c
  149. trace-events
  150. translate-all.c
  151. translate-all.h
  152. user-exec.c
  153. VERSION
  154. version.rc
  155. vl.c
  156. xbzrle.c
  157. xen-all.c
  158. xen-mapcache.c
  159. xen-stub.c