[virt-tools-list] [virt-viewer v1] app: Only disconnect if it was connected previously

Victor Toso victortoso at redhat.com
Tue Jun 6 09:03:11 UTC 2017


From: Victor Toso <me at victortoso.com>

When user cancels an authentication dialog, virt-viewer-session-vnc.c
will correctly emit "session-cancelled" and after that it will emit
"session-disconnected" which is not correct as the connect was not
establish at that moment.

The reason for emitting "session-disconnected" is VncDisplay that
emits "vnc-disconnected" wrongly.

A simple fix to avoid wrong authentication dialog being displayed with
VNC is to simple put a guard on virt_viewer_app_disconnected() as this
function should not be triggered if session was not connected before.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1446161

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/virt-viewer-app.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 2a88882..74d3e70 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1439,6 +1439,8 @@ virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED, const gch
     VirtViewerAppPrivate *priv = self->priv;
     gboolean connect_error = !priv->connected && !priv->cancelled;
 
+    g_return_if_fail(priv->connected);
+
     if (!priv->kiosk)
         virt_viewer_app_hide_all_windows(self);
     else if (priv->cancelled)
-- 
2.13.0




More information about the virt-tools-list mailing list