[virt-tools-list] [virt-viewer][PATCH 2/7 v3] virt-viewer: Add a GError arg to update_display()

Christophe Fergeau cfergeau at redhat.com
Fri Mar 27 09:33:48 UTC 2015


On Thu, Mar 26, 2015 at 11:26:55PM +0100, Fabiano Fidêncio wrote:
> This is part of a small re-factoring that will have all connection
> errors, when we won't be able to connect regardless of what changes on
> the remote host, being treated by virt_viewer_app_initial_connect(),
> avoiding weird behaviors as we have nowadays (like more than one error
> dialog being shown or having the virt-viewer waiting forever for a guest
> that will never show up).
> 
> Related: rhbz#1085216
> ---
>  src/virt-viewer.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index 1c9f59d..b84eaa7 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -520,7 +520,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
>  }
>  
>  static gboolean
> -virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
> +virt_viewer_update_display(VirtViewer *self, virDomainPtr dom, GError **error)
>  {
>      VirtViewerPrivate *priv = self->priv;
>      VirtViewerApp *app = VIRT_VIEWER_APP(self);
> @@ -536,7 +536,7 @@ virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
>      g_object_set(app, "guest-name", virDomainGetName(dom), NULL);
>  
>      if (!virt_viewer_app_has_session(app)) {
> -        if (!virt_viewer_extract_connect_info(self, dom, NULL))
> +        if (!virt_viewer_extract_connect_info(self, dom, error))
>              return FALSE;
>      }
>  
> @@ -611,7 +611,10 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
>          break;
>  
>      case VIR_DOMAIN_EVENT_STARTED:
> -        virt_viewer_update_display(self, dom);
> +        virt_viewer_update_display(self, dom, &error);
> +        if (error)
> +            g_clear_error(&error);
> +

A bit weird to have this here, I'd just pass NULL for now.

Christophe

>          virt_viewer_app_activate(app, &error);
>          if (error) {
>              /* we may want to consolidate error reporting in
> @@ -778,7 +781,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
>          goto wait;
>      }
>  
> -    if (!virt_viewer_update_display(self, dom))
> +    if (!virt_viewer_update_display(self, dom, &err))
>          goto wait;
>  
>      ret = VIRT_VIEWER_APP_CLASS(virt_viewer_parent_class)->initial_connect(app, &err);
> -- 
> 2.3.3
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- 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/20150327/57d0c316/attachment.sig>


More information about the virt-tools-list mailing list