[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qom: removal of link property need to release i
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target |
Date: |
Wed, 22 Aug 2012 19:07:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
Am 22.08.2012 05:02, schrieb Liu Ping Fan:
> From: Liu Ping Fan <address@hidden>
>
> 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 <address@hidden>
> ---
> 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
- [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Liu Ping Fan, 2012/08/21
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Paolo Bonzini, 2012/08/22
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Anthony Liguori, 2012/08/22
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Paolo Bonzini, 2012/08/22
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Anthony Liguori, 2012/08/22
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Paolo Bonzini, 2012/08/22
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Anthony Liguori, 2012/08/22
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, Paolo Bonzini, 2012/08/23
- Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target, liu ping fan, 2012/08/23
Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target,
Andreas Färber <=