From: Akihiko Odaki Date: Wed, 24 Sep 2025 04:37:22 +0000 (+0900) Subject: hw/core/register: Do not unparent in instance_finalize() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9ce08489424905ae4a70218fa35013fe88d54ed;p=thirdparty%2Fqemu.git hw/core/register: Do not unparent in instance_finalize() Children are automatically unparented so manually unparenting is unnecessary. Worse, automatic unparenting happens before the instance_finalize() callback of the parent gets called, so object_unparent() calls in the callback will refer to objects that are already unparented, which is semantically incorrect. Signed-off-by: Akihiko Odaki Reviewed-by: Daniel P. Berrangé Link: https://lore.kernel.org/r/20250924-use-v4-3-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Paolo Bonzini --- diff --git a/hw/core/register.c b/hw/core/register.c index 8f63d9f227c..3340df70b06 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -314,7 +314,6 @@ RegisterInfoArray *register_init_block64(DeviceState *owner, void register_finalize_block(RegisterInfoArray *r_array) { - object_unparent(OBJECT(&r_array->mem)); g_free(r_array->r); g_free(r_array); }