[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 2/3] qom: call class destructor before unpare
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v9 2/3] qom: call class destructor before unparent |
Date: |
Thu, 21 Mar 2013 13:25:50 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
Il 21/03/2013 13:07, Michael S. Tsirkin ha scritto:
> Make sure object is valid when destructor is called.
"Make sure the object still has a canonical path while the unparent
callback is running".
Otherwise, the series looks good.
Paolo
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
> qom/object.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index 3d638ff..a0e3cbe 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -363,12 +363,12 @@ static void object_property_del_child(Object *obj,
> Object *child, Error **errp)
> void object_unparent(Object *obj)
> {
> object_ref(obj);
> - if (obj->parent) {
> - object_property_del_child(obj->parent, obj, NULL);
> - }
> if (obj->class->unparent) {
> (obj->class->unparent)(obj);
> }
> + if (obj->parent) {
> + object_property_del_child(obj->parent, obj, NULL);
> + }
> object_unref(obj);
> }
>
>