qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Liu Ping Fan <qemulist@gmail.com>
Cc: Liu Ping Fan <pingfank@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target
Date: Wed, 22 Aug 2012 19:07:02 +0200	[thread overview]
Message-ID: <503511B6.3050401@suse.de> (raw)
In-Reply-To: <1345604562-27289-1-git-send-email-qemulist@gmail.com>

Am 22.08.2012 05:02, schrieb Liu Ping Fan:
> From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> 
> Currently, link property's target is only managed by
> object_set_link_property(). This will raise such issue that when
> the property is finalized, its target has no opportunity to release.
> 
> Fix this issue by introduce object_finalize_link_property()
> 
> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> ---
>  qom/object.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index a552be2..76b3d34 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -957,6 +957,16 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
>      }
>  }
>  
> +static void object_finalize_link_property(Object *obj, const char *name,
> +                                           void *opaque)
> +{
> +    Object **child = opaque;
> +
> +    if (*child != NULL) {
> +        object_unref(*child);
> +    }
> +}

The naming is confusing: In ObjectProperty this hook is called "release"
and you're not finalizing the value either, just unref'ing, which may or
may not lead to the finalizer being called.

I'd thus propose "object_release_link_property" for whatever gets
decided its implementation should do.

Regards,
Andreas

> +
>  void object_property_add_link(Object *obj, const char *name,
>                                const char *type, Object **child,
>                                Error **errp)
> @@ -968,7 +978,7 @@ void object_property_add_link(Object *obj, const char *name,
>      object_property_add(obj, name, full_type,
>                          object_get_link_property,
>                          object_set_link_property,
> -                        NULL, child, errp);
> +                        object_finalize_link_property, child, errp);
>  
>      g_free(full_type);
>  }

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

      parent reply	other threads:[~2012-08-22 17:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22  3:02 [Qemu-devel] [PATCH] qom: removal of link property need to release its target Liu Ping Fan
2012-08-22 12:02 ` Paolo Bonzini
2012-08-22 16:36   ` Anthony Liguori
2012-08-22 20:55     ` Paolo Bonzini
2012-08-22 21:41       ` Anthony Liguori
2012-08-22 22:01         ` Paolo Bonzini
2012-08-22 22:40           ` Anthony Liguori
2012-08-23  8:35             ` Paolo Bonzini
2012-08-23  8:02     ` liu ping fan
2012-08-22 17:07 ` Andreas Färber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=503511B6.3050401@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=pingfank@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).