[virt-tools-list] [virt-viewer 2/4] Handle virt_viewer_app_start() errors

Christophe Fergeau cfergeau at redhat.com
Tue Oct 29 13:55:59 UTC 2013


remote_viewer_deactivated() can be calling virt_viewer_app_start()
without checking whether it returns TRUE or FALSE. It returns FALSE
when it was not successful (when it failed to parse the URI to connect
to for example, or whe the user presses Cancel in the connection dialog).

This means that if the user starts remote-viewer, enters a valid URI
in the connection dialog to which it cannot connect to
(spice://example.com:999) and then presses Cancel in the connection
dialog that appears after the connection  failure, then remote-viewer
will be sitting there with an empty window doing nothing.

This commit ensures we chain to the parent class when
virt_viewer_app_start() returns FALSE, which causes remote-viewer to
exit.
---
 src/remote-viewer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index b6451ab..739c937 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -161,8 +161,9 @@ remote_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
     RemoteViewerPrivate *priv = self->priv;
 
     if (connect_error && priv->open_recent_dialog) {
-        virt_viewer_app_start(app);
-        return;
+        if (virt_viewer_app_start(app)) {
+            return;
+        }
     }
 
     VIRT_VIEWER_APP_CLASS(remote_viewer_parent_class)->deactivated(app, connect_error);
-- 
1.8.3.1




More information about the virt-tools-list mailing list