[virt-tools-list] [RFC virt-viewer] virt-viewer-app: force quit if quit is requested twice

Kevin Pouget kpouget at redhat.com
Thu Oct 31 11:19:17 UTC 2019


The investigation of BZ#1713548 shows that the viewer cannot be closed
if Spice-GTK does not send the DISCONNECTED signal [1].

This patch allows a 'force-close' if the user requests twice to close
the app:

1. The first time, `virt_viewer_session_close(VIRT_VIEWER_SESSION(priv->session))` is called, which should trigger the DISCONNECTED signal and close the app. If this fails,
2. The second time, the application is closed, no matter the internal state.

See [2] for the patch that introduced the two-step disconnection.

1: https://gitlab.freedesktop.org/spice/spice-gtk/blob/0c52ce8937c849d8ae32ade1f22ce3a48c56c732/src/spice-session.c#L2322
2: https://pagure.io/virt-viewer/c/8ec03e50
---
 src/virt-viewer-app.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index da8cfa9..7edfe8c 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -296,7 +296,7 @@ virt_viewer_app_quit(VirtViewerApp *self)
                                       VIRT_VIEWER_SESSION_VM_ACTION_QUIT);
     }
 
-    if (priv->session) {
+    if (priv->session && !priv->quitting) {
         virt_viewer_session_close(VIRT_VIEWER_SESSION(priv->session));
         if (priv->connected) {
             priv->quitting = TRUE;
-- 
2.21.0




More information about the virt-tools-list mailing list