From patchwork Thu Feb 2 16:45:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 139155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D2B21104792 for ; Fri, 3 Feb 2012 03:46:26 +1100 (EST) Received: from localhost ([::1]:48629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rsznj-0004SB-0A for incoming@patchwork.ozlabs.org; Thu, 02 Feb 2012 11:46:23 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsznP-00046e-Vp for qemu-devel@nongnu.org; Thu, 02 Feb 2012 11:46:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsznL-0002Yt-RA for qemu-devel@nongnu.org; Thu, 02 Feb 2012 11:46:03 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:35764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsznL-0002WX-CY for qemu-devel@nongnu.org; Thu, 02 Feb 2012 11:45:59 -0500 Received: by mail-pz0-f45.google.com with SMTP id p14so2506378dad.4 for ; Thu, 02 Feb 2012 08:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=cBIcpO713GFgLkLke4Mf8B9fjGyO0os+kgymFjwjkDw=; b=eXo2ZbPw2s4UnuT/Z8Xw77SdVdyHtO5rnJtwiAkBDoJd+60CWRhmD9V8SjiUJURIw+ +ftgt+ljJjgHZQR0g4kP/YHhs2eaV/O4f8aqPndLagRyQP8/kqd49JZshd/ILypHFcUX kR+HPCCwo1B1EvzJkbLQhXSiR/kS6pHmAvAjA= Received: by 10.68.189.196 with SMTP id gk4mr9200909pbc.44.1328201159016; Thu, 02 Feb 2012 08:45:59 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-182-16.ip50.fastwebnet.it. [93.34.182.16]) by mx.google.com with ESMTPS id x4sm6756321pbx.16.2012.02.02.08.45.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Feb 2012 08:45:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 2 Feb 2012 17:45:28 +0100 Message-Id: <1328201142-26145-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> References: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.45 Subject: [Qemu-devel] [PATCH 02/16] qom: store object with correct type in interface links X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When a link property's type is an interface, the code expects the implementation object (not the parent object) to be stored in the variable. The parent object does not contain the right vtable. Signed-off-by: Paolo Bonzini --- qom/object.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qom/object.c b/qom/object.c index cd517f6..de6484d 100644 --- a/qom/object.c +++ b/qom/object.c @@ -749,7 +749,8 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque, target_type = g_strdup(&type[5]); target_type[strlen(target_type) - 2] = 0; - if (object_dynamic_cast(target, target_type)) { + target = object_dynamic_cast(target, target_type); + if (target) { object_ref(target); *child = target; } else {