From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIeZE-0002AH-7m for qemu-devel@nongnu.org; Thu, 21 Mar 2013 08:26:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIeZC-0005La-Ae for qemu-devel@nongnu.org; Thu, 21 Mar 2013 08:26:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIeZC-0005Kw-3E for qemu-devel@nongnu.org; Thu, 21 Mar 2013 08:25:58 -0400 Message-ID: <514AFC4E.4070804@redhat.com> Date: Thu, 21 Mar 2013 13:25:50 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v9 2/3] qom: call class destructor before unparent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Kevin Wolf , Anthony Liguori , Eduardo Habkost , libvir-list@redhat.com, Stefan Hajnoczi , Markus Armbruster , qemu-devel@nongnu.org, Gerd Hoffmann , Luiz Capitulino , afaerber@suse.de 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 > --- > 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); > } > >