[virt-tools-list] [virt-viewer][PATCH 2/3] Prefer to use virConnectDomainEventRegisterAny()
Christophe Fergeau
cfergeau at redhat.com
Wed Nov 19 12:10:31 UTC 2014
On Wed, Nov 19, 2014 at 05:58:22AM +0100, Fabiano Fidêncio wrote:
> The usage of virConnectDomainEventRegister() is no longer recommended
> according to the libvirt's documentation.
>
> Related to: rhbz#1164052
> https://bugzilla.redhat.com/show_bug.cgi?id=1164052
> ---
> src/virt-viewer.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index 9fa2a80..bc831dc 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -59,6 +59,7 @@ struct _VirtViewerPrivate {
> gboolean waitvm;
> gboolean reconnect;
> gboolean auth_cancelled;
> + gint domain_event;
> };
>
> G_DEFINE_TYPE (VirtViewer, virt_viewer, VIRT_VIEWER_TYPE_APP)
> @@ -530,9 +531,11 @@ virt_viewer_dispose (GObject *object)
> VirtViewerPrivate *priv = self->priv;
>
> if (priv->conn) {
> - if (priv->withEvents)
> - virConnectDomainEventDeregister(priv->conn,
> - virt_viewer_domain_event);
> + if (priv->withEvents) {
> + virConnectDomainEventDeregisterAny(priv->conn,
> + priv->domain_event);
> + priv->domain_event = -1;
> + }
On second thought, priv->withEvents and priv->domain_events are
redundant now (priv->withEvents would be (priv->domain_events >= 0) if
domain_events is set to -1 in the gobject _init function.
This can be changed in an additional patch though if you think this is
a useful change.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20141119/27d06e6b/attachment.sig>
More information about the virt-tools-list
mailing list