On 12/7/26 00:36, Alexander Graf wrote:
pcspk was created in pc_machine_initfn() as an orphan and manually
unref'd in pc_machine_finalize() when the machine was never realized
(e.g. -M pc,help).  Making it a child<> of the machine at creation
time lets the QOM property teardown in object_property_del_all()
handle that lifecycle for free, so pc_machine_finalize() and its
open-coded refcount juggling can go.

The realize path switches from isa_realize_and_unref() to plain
qdev_realize() because the reference is now held by the parent's
child<> property, not the caller.

Nice.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

Assisted-by: Kiro
Signed-off-by: Alexander Graf <[email protected]>
---
  hw/i386/pc.c | 14 ++------------
  1 file changed, 2 insertions(+), 12 deletions(-)


Reply via email to