virt-manager/53b409bd-console-prevent-access-to-deleted-objects.patch

51 lines
1.9 KiB
Diff
Raw Normal View History

Subject: console: prevent access to deleted objects
From: Giuseppe Scrivano gscrivan@redhat.com Tue Jul 1 15:01:58 2014 +0200
Date: Wed Jul 2 15:31:41 2014 +0200:
Git: f4365b669acc36bdc61c57d793894305dcb9059a
last commits revealed that some objects can still be accessed by
registered callbacks after the console is closed. Unregister these
callbacks.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Index: virt-manager-1.0.1/virtManager/console.py
===================================================================
--- virt-manager-1.0.1.orig/virtManager/console.py
+++ virt-manager-1.0.1/virtManager/console.py
@@ -572,6 +572,7 @@ class SpiceViewer(Viewer):
self.display = None
self.audio = None
self.main_channel = None
+ self._main_channel_hids = []
self.display_channel = None
self.usbdev_manager = None
@@ -636,6 +637,11 @@ class SpiceViewer(Viewer):
self.display.destroy()
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.usbdev_manager = None
@@ -682,10 +688,12 @@ class SpiceViewer(Viewer):
if self.console.tunnels:
self.console.tunnels.unlock()
self.main_channel = channel
- self.main_channel.connect_after("channel-event",
+ hid = self.main_channel.connect_after("channel-event",
self._main_channel_event_cb)
- self.main_channel.connect_after("notify::agent-connected",
+ self._main_channel_hids.append(hid)
+ hid = self.main_channel.connect_after("notify::agent-connected",
self._agent_connected_cb)
+ self._main_channel_hids.append(hid)
elif (type(channel) == SpiceClientGLib.DisplayChannel and
not self.display):