Blob Blame History Raw
From 05734770fc507a7789807bfff4244136b56d36fa Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Tue, 21 Oct 2014 15:43:37 +0200
Subject: [PATCH 3/3] virt-manager: close the SPICE main channel on an AUTH
 error

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1152981

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit f19a07d5a53e6004fcd8378ccf6303b0fafd9db5)
---
 virtManager/console.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/virtManager/console.py b/virtManager/console.py
index 8f828df..aa3982b 100644
--- a/virtManager/console.py
+++ b/virtManager/console.py
@@ -626,6 +626,13 @@ class SpiceViewer(Viewer):
     def set_grab_keyboard(self):
         self.display.set_property("grab-keyboard", self.config.get_grab_keyboard())
 
+    def _close_main_channel(self):
+        for i in self._main_channel_hids:
+            self.main_channel.handler_disconnect(i)
+        self._main_channel_hids = []
+
+        self.main_channel = None
+
     def close(self):
         if self.spice_session is not None:
             self.spice_session.disconnect()
@@ -636,11 +643,7 @@ class SpiceViewer(Viewer):
         self.display = None
         self.display_channel = None
 
-        for i in self._main_channel_hids:
-            self.main_channel.handler_disconnect(i)
-        self._main_channel_hids = []
-
-        self.main_channel = None
+        self._close_main_channel()
         self.usbdev_manager = None
 
     def is_open(self):
@@ -654,6 +657,7 @@ class SpiceViewer(Viewer):
             self.console.disconnected()
         elif event == SpiceClientGLib.ChannelEvent.ERROR_AUTH:
             self.console.activate_auth_page()
+            self._close_main_channel()
         elif event in [SpiceClientGLib.ChannelEvent.ERROR_CONNECT,
                        SpiceClientGLib.ChannelEvent.ERROR_IO,
                        SpiceClientGLib.ChannelEvent.ERROR_LINK,
-- 
1.9.3