Handle virt_viewer_app_start() errors

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.
This commit is contained in:
Christophe Fergeau 2013-10-29 13:21:41 +01:00
parent b19a246c5c
commit 30bb4019fd

View File

@ -160,8 +160,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);