Blame SOURCES/0022-vnc-no-dialog-for-server-closed-connection-error.patch

19ccae
From 74fdd26c949847bca41c7ca71bc88d30d92d92aa Mon Sep 17 00:00:00 2001
19ccae
From: Uri Lublin <uril@redhat.com>
19ccae
Date: Sun, 17 Jan 2021 19:25:57 +0200
19ccae
Subject: [PATCH] vnc: no dialog for server-closed-connection error
19ccae
19ccae
Following commit de5cd71, when the server closes the connection
19ccae
(likely when qemu-kvm exits), a dialog is shown to the user.
19ccae
19ccae
This behavior change is not good for automatic tests that expect
19ccae
virt-viewer to exit without any dialog.
19ccae
19ccae
This patch makes sure no dialog is shown for this error, by
19ccae
checking if the VNC connection was already initialized.
19ccae
19ccae
Signed-off-by: Uri Lublin <uril@redhat.com>
19ccae
---
19ccae
 src/virt-viewer-app.c | 8 +++++++-
19ccae
 1 file changed, 7 insertions(+), 1 deletion(-)
19ccae
19ccae
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
19ccae
index 8d795ca..4a579f8 100644
19ccae
--- a/src/virt-viewer-app.c
19ccae
+++ b/src/virt-viewer-app.c
19ccae
@@ -139,6 +139,7 @@ struct _VirtViewerAppPrivate {
19ccae
     gboolean kiosk;
19ccae
     gboolean vm_ui;
19ccae
     gboolean vm_running;
19ccae
+    gboolean initialized;
19ccae
 
19ccae
     VirtViewerSession *session;
19ccae
     gboolean active;
19ccae
@@ -1651,6 +1652,7 @@ virt_viewer_app_deactivate(VirtViewerApp *self, gboolean connect_error)
19ccae
         virt_viewer_session_close(VIRT_VIEWER_SESSION(priv->session));
19ccae
     }
19ccae
 
19ccae
+    priv->initialized = FALSE;
19ccae
     priv->connected = FALSE;
19ccae
     priv->active = FALSE;
19ccae
     priv->started = FALSE;
19ccae
@@ -1689,6 +1691,7 @@ static void
19ccae
 virt_viewer_app_initialized(VirtViewerSession *session G_GNUC_UNUSED,
19ccae
                             VirtViewerApp *self)
19ccae
 {
19ccae
+    self->priv->initialized = TRUE;
19ccae
     virt_viewer_app_update_title(self);
19ccae
 }
19ccae
 
19ccae
@@ -1727,7 +1730,10 @@ virt_viewer_app_error(VirtViewerSession *session G_GNUC_UNUSED,
19ccae
 {
19ccae
     VirtViewerAppPrivate *priv = self->priv;
19ccae
 
19ccae
-    priv->connected = FALSE; /* display error dialog */
19ccae
+    /* Do not open a dialog if the connection was initialized
19ccae
+     * This happens when the VNC server closes the connection */
19ccae
+    if (!priv->initialized)
19ccae
+        priv->connected = FALSE; /* display error dialog */
19ccae
 
19ccae
     virt_viewer_app_disconnected(session, msg, self);
19ccae
 }
19ccae
-- 
19ccae
2.29.2
19ccae