diff --git a/virtManager/console.py b/virtManager/console.py index dd9baae14..e1fa808ab 100644 --- a/virtManager/console.py +++ b/virtManager/console.py @@ -621,7 +621,7 @@ class vmmConsolePages(vmmGObjectUI): gdevs = self.vm.get_graphics_devices() gdev = gdevs and gdevs[0] or None if gdev: - ginfo = ConnectionInfo(self.vm, gdev) + ginfo = ConnectionInfo(self.vm.conn, gdev) except Exception, e: # We can fail here if VM is destroyed: xen is a bit racy # and can't handle domain lookups that soon after @@ -667,7 +667,7 @@ class vmmConsolePages(vmmGObjectUI): "SpiceClientGtk missing") - self._viewer = viewer_class(ginfo) + self._viewer = viewer_class(self.vm, ginfo) self._connect_viewer_signals() self._refresh_enable_accel() diff --git a/virtManager/sshtunnels.py b/virtManager/sshtunnels.py index 3d4606de5..f08a9861b 100644 --- a/virtManager/sshtunnels.py +++ b/virtManager/sshtunnels.py @@ -32,9 +32,7 @@ class ConnectionInfo(object): """ Holds all the bits needed to make a connection to a graphical console """ - def __init__(self, vm, gdev): - conn = vm.conn - self.vm = vm + def __init__(self, conn, gdev): self.gtype = gdev.type self.gport = gdev.port and str(gdev.port) or None self.gsocket = gdev.socket @@ -49,9 +47,6 @@ class ConnectionInfo(object): if self._connhost == "localhost": self._connhost = "127.0.0.1" - def get_conn_fd(self): - return self.vm.open_graphics_fd() - def _is_listen_localhost(self, host=None): try: return ipaddr.IPNetwork(host or self.gaddr).is_loopback diff --git a/virtManager/viewers.py b/virtManager/viewers.py index e0068cb22..0f72a06fb 100644 --- a/virtManager/viewers.py +++ b/virtManager/viewers.py @@ -64,9 +64,10 @@ class Viewer(vmmGObject): "usb-redirect-error": (GObject.SignalFlags.RUN_FIRST, None, [str]), } - def __init__(self, ginfo): + def __init__(self, vm, ginfo): vmmGObject.__init__(self) self._display = None + self._vm = vm self._ginfo = ginfo self._tunnels = SSHTunnels(self._ginfo) @@ -84,6 +85,7 @@ class Viewer(vmmGObject): if self._display: self._display.destroy() self._display = None + self._vm = None self._tunnels.close_all() @@ -137,7 +139,7 @@ class Viewer(vmmGObject): def _get_fd_for_open(self): if self._ginfo.need_tunnel(): return self._tunnels.open_new() - return self._ginfo.get_conn_fd() + return self._vm.open_graphics_fd() def _open(self): fd = self._get_fd_for_open()