]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/commit
qom/object.c: Reset interface list on inheritance
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Tue, 19 Feb 2013 04:02:09 +0000 (14:02 +1000)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 21 Feb 2013 22:34:10 +0000 (16:34 -0600)
commit3e407de47700cce4babbe0f3ac35677e7b852cf6
treea9dfbad3f85b5870769016fc4662119fe4af2d98
parentb1424e0381a7f1c9969079eca4458d5f20bf1859
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>
qom/object.c