Re: [PATCH 29/40] datatypes: convert virDomain to GObject

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 13, 2020 at 01:57:13PM +0200, Rafael Fonseca wrote:
> Signed-off-by: Rafael Fonseca <r4f4rfs@xxxxxxxxx>
> ---
>  src/conf/domain_event.c             |  58 ++++++------
>  src/datatypes.c                     |  50 ++++++----
>  src/datatypes.h                     |  20 ++--
>  src/esx/esx_driver.c                |   7 +-
>  src/hyperv/hyperv_driver.c          |   8 +-
>  src/libvirt-domain.c                |   6 +-
>  src/libvirt_private.syms            |   2 +-
>  src/libxl/libxl_migration.c         |   3 +-
>  src/locking/sanlock_helper.c        |   5 +-
>  src/qemu/qemu_driver.c              |   6 +-
>  src/qemu/qemu_migration.c           |   6 +-
>  src/remote/remote_daemon_dispatch.c | 139 +++++++++-------------------
>  src/remote/remote_driver.c          | 100 ++++++--------------
>  src/rpc/gendispatch.pl              |   6 +-
>  src/vbox/vbox_common.c              |  11 +--
>  src/vz/vz_driver.c                  |   5 +-
>  16 files changed, 161 insertions(+), 271 deletions(-)
> 
> diff --git a/src/datatypes.c b/src/datatypes.c
> index 1c8eff9685..0af5c326a1 100644
> --- a/src/datatypes.c
> +++ b/src/datatypes.c
> @@ -1133,7 +1143,7 @@ virGetDomainCheckpoint(virDomainPtr domain,
>      ret = VIR_DOMAIN_CHECKPOINT(g_object_new(VIR_TYPE_DOMAIN_CHECKPOINT, NULL));
>      ret->name = g_strdup(name);
>  
> -    ret->domain = virObjectRef(domain);
> +    ret->domain = g_object_ref(domain);
>  
>      return g_steal_pointer(&ret);
>  }
> @@ -1186,7 +1196,7 @@ virGetDomainSnapshot(virDomainPtr domain, const char *name)
>      ret = VIR_DOMAIN_SNAPSHOT(g_object_new(VIR_TYPE_DOMAIN_SNAPSHOT, NULL));
>      ret->name = g_strdup(name);
>  
> -    ret->domain = virObjectRef(domain);
> +    ret->domain = g_object_ref(domain);
>  
>      return g_steal_pointer(&ret);
>  }

Missed the unref side

diff --git a/src/datatypes.c b/src/datatypes.c
index 0af5c326a1..cf3a8e7857 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -1166,7 +1166,7 @@ virDomainCheckpointFinalize(GObject *obj)
     VIR_DEBUG("release checkpoint %p %s", checkpoint, checkpoint->name);
 
     VIR_FREE(checkpoint->name);
-    virObjectUnref(checkpoint->domain);
+    g_clear_object(&checkpoint->domain);
 
     G_OBJECT_CLASS(vir_domain_checkpoint_parent_class)->finalize(obj);
 }
@@ -1219,7 +1219,7 @@ virDomainSnapshotFinalize(GObject *obj)
     VIR_DEBUG("release snapshot %p %s", snapshot, snapshot->name);
 
     VIR_FREE(snapshot->name);
-    virObjectUnref(snapshot->domain);
+    g_clear_object(&snapshot->domain);
 
     G_OBJECT_CLASS(vir_domain_snapshot_parent_class)->finalize(obj);
 }


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux