[libvirt] [libvirt-glib] Add async variant of gvir_domain_get_info()
Christophe Fergeau
cfergeau at redhat.com
Thu Apr 19 14:03:24 UTC 2012
On Thu, Apr 19, 2012 at 04:45:29PM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>
> ---
> libvirt-gobject/libvirt-gobject-domain.c | 74 ++++++++++++++++++++++++++++++
> libvirt-gobject/libvirt-gobject-domain.h | 7 +++
> libvirt-gobject/libvirt-gobject.sym | 4 +-
> 3 files changed, 84 insertions(+), 1 deletions(-)
>
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index 0bafa7e..c1a2086 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -572,6 +572,80 @@ GVirDomainInfo *gvir_domain_get_info(GVirDomain *dom,
> return ret;
> }
>
> +static void
> +gvir_domain_get_info_helper(GSimpleAsyncResult *res,
> + GObject *object,
> + GCancellable *cancellable G_GNUC_UNUSED)
> +{
> + GVirDomain *dom = GVIR_DOMAIN(object);
> + GVirDomainInfo *info;
> + GError *err = NULL;
> +
> + info = gvir_domain_get_info(dom, &err);
> + if (err)
> + g_simple_async_result_take_error(res, err);
> + else
> + g_simple_async_result_set_op_res_gpointer(res, info, NULL);
I still think this can leak memory in error cases/corner cases, see my answer to
your first patch.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120419/462eb5ef/attachment-0001.sig>
More information about the libvir-list
mailing list