From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN1bD-0002Q2-5O for qemu-devel@nongnu.org; Tue, 02 Apr 2013 09:50:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UN1bC-0005cS-4D for qemu-devel@nongnu.org; Tue, 02 Apr 2013 09:50:07 -0400 Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:63269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN1bB-0005a7-V2 for qemu-devel@nongnu.org; Tue, 02 Apr 2013 09:50:06 -0400 Received: by mail-ea0-f171.google.com with SMTP id b15so236749eae.16 for ; Tue, 02 Apr 2013 06:50:05 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 2 Apr 2013 15:50:00 +0200 Message-Id: <1364910600-3418-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] qom: do nothing on unparent of object without parent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: afaerber@suse.de Otherwise, device_unparent will fail to get a canonical path of the object. Signed-off-by: Paolo Bonzini --- qom/object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qom/object.c b/qom/object.c index 8818149..093502e 100644 --- a/qom/object.c +++ b/qom/object.c @@ -362,6 +362,10 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) void object_unparent(Object *obj) { + if (!obj->parent) { + return; + } + object_ref(obj); if (obj->class->unparent) { (obj->class->unparent)(obj); -- 1.8.1.4