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

Re: [virt-tools-list] [PATCH virt-viewer] Unregister events and callbacks on dispose



looks good, ack

----- Mensaje original -----
> Without these libvirtd reports an error on virt-viewer shutdown:
> virNetSocketReadWire:1377 : End of file while reading data: Input/output
> error
> ---
>  src/virt-viewer.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index 207c9ca..b98c252 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -67,6 +67,7 @@ static gboolean virt_viewer_initial_connect(VirtViewerApp
> *self, GError **error)
>  static gboolean virt_viewer_open_connection(VirtViewerApp *self, int *fd);
>  static void virt_viewer_deactivated(VirtViewerApp *self, gboolean
>  connect_error);
>  static gboolean virt_viewer_start(VirtViewerApp *self);
> +static void virt_viewer_dispose (GObject *object);
>  
>  static void
>  virt_viewer_get_property (GObject *object, guint property_id,
> @@ -89,18 +90,6 @@ virt_viewer_set_property (GObject *object, guint
> property_id,
>  }
>  
>  static void
> -virt_viewer_dispose (GObject *object)
> -{
> -    VirtViewer *self = VIRT_VIEWER(object);
> -    VirtViewerPrivate *priv = self->priv;
> -    if (priv->dom)
> -        virDomainFree(priv->dom);
> -    if (priv->conn)
> -        virConnectClose(priv->conn);
> -    G_OBJECT_CLASS(virt_viewer_parent_class)->dispose (object);
> -}
> -
> -static void
>  virt_viewer_class_init (VirtViewerClass *klass)
>  {
>      GObjectClass *object_class = G_OBJECT_CLASS (klass);
> @@ -513,6 +502,24 @@ virt_viewer_conn_event(virConnectPtr conn G_GNUC_UNUSED,
>      virt_viewer_app_start_reconnect_poll(app);
>  }
>  
> +static void
> +virt_viewer_dispose (GObject *object)
> +{
> +    VirtViewer *self = VIRT_VIEWER(object);
> +    VirtViewerPrivate *priv = self->priv;
> +
> +    if (priv->withEvents)
> +        virConnectDomainEventDeregister(priv->conn,
> +                                        virt_viewer_domain_event);
> +    virConnectUnregisterCloseCallback(priv->conn,
> +                                      virt_viewer_conn_event);
> +    if (priv->dom)
> +        virDomainFree(priv->dom);
> +    if (priv->conn)
> +        virConnectClose(priv->conn);
> +    G_OBJECT_CLASS(virt_viewer_parent_class)->dispose (object);
> +}
> +
>  static int virt_viewer_connect(VirtViewerApp *app);
>  
>  static gboolean
> --
> 1.8.1.5
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list redhat com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 


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