Paolo Bonzini b09995aef1 qdev: drop extra references at creation time
qdev_free and qbus_free have to do unparent+unref, because nobody else
drops the initial reference (the one included by object_initialize)
before them.

For device_init_func and do_device_add, this is trivially correct,
since the DeviceState goes out of scope.

For qdev_create, qdev_try_create and qbus_init, it is a bit more tricky.
What we are doing here is just assuming that the caller knows what it's
doing, and won't call qdev_free/qbus_free while the device is still there.
This is a pretty reasonable assumption and (behind the scenes) is also
what GObject/GTK does.  GTK actually has a "floating reference" that
goes away as soon as the caller does gtk_container_add or something
like that, but in the end qbus_init and qdev_try_create are already
adding the new object to its qdev parent!  So in the end the two solutions
are the same.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-01 15:53:11 -06:00
..
2013-02-01 00:13:41 +01:00
2013-02-01 15:53:09 -06:00
2013-02-01 11:03:01 -06:00
2013-01-25 22:02:55 +01:00
2013-01-25 22:02:55 +01:00
2013-02-01 11:03:00 -06:00
2013-01-25 22:02:55 +01:00
2013-02-01 11:03:01 -06:00
2013-02-01 10:43:24 -06:00
2013-02-01 11:03:01 -06:00
2013-02-01 11:03:01 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 10:43:24 -06:00
2013-02-01 10:43:24 -06:00
2013-01-30 01:31:09 +02:00
2013-02-01 00:13:41 +01:00
2013-02-01 10:43:28 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 10:43:24 -06:00
2013-01-25 22:02:54 +01:00
2013-01-25 22:02:54 +01:00
2013-01-26 13:15:37 +00:00
2013-02-01 11:03:01 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:01 -06:00
2013-02-01 11:03:00 -06:00
2013-01-30 01:31:09 +02:00
2013-02-01 11:03:01 -06:00
2013-02-01 11:03:00 -06:00
2013-01-27 23:04:26 +01:00
2013-02-01 10:43:24 -06:00
2013-02-01 11:03:01 -06:00
2013-01-22 11:01:07 +01:00
2013-02-01 00:13:41 +01:00
2013-02-01 11:03:01 -06:00
2013-01-24 09:45:03 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00
2013-01-25 22:02:53 +01:00
2013-02-01 11:03:02 -06:00
2013-02-01 11:03:02 -06:00
2013-02-01 11:03:02 -06:00
2013-02-01 11:03:02 -06:00
2013-02-01 11:03:03 -06:00
2013-02-01 10:43:24 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00
2013-02-01 11:03:00 -06:00