From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt06X-0006iM-CU for qemu-devel@nongnu.org; Thu, 02 Feb 2012 12:05:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt06P-0006w8-IL for qemu-devel@nongnu.org; Thu, 02 Feb 2012 12:05:49 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:42353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt06P-0006vw-60 for qemu-devel@nongnu.org; Thu, 02 Feb 2012 12:05:41 -0500 Received: by dadp14 with SMTP id p14so2523900dad.4 for ; Thu, 02 Feb 2012 09:05:40 -0800 (PST) Message-ID: <4F2AC260.50709@codemonkey.ws> Date: Thu, 02 Feb 2012 11:05:36 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> <1328201142-26145-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328201142-26145-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/16] qom: store object with correct type in interface links List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 02/02/2012 10:45 AM, Paolo Bonzini wrote: > 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; Very good catch. Regards, Anthony Liguori > } else {