console: prevent access to deleted objects

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>
This commit is contained in:
Giuseppe Scrivano 2014-07-01 15:01:58 +02:00
parent 538c68a41d
commit f4365b669a
1 changed files with 10 additions and 2 deletions

View File

@ -570,6 +570,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
@ -634,6 +635,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
@ -680,10 +686,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):