[PATCH virt-manager 3/3] console: prevent access to deleted objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 virtManager/console.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/virtManager/console.py b/virtManager/console.py
index 069925d..8f828df 100644
--- a/virtManager/console.py
+++ b/virtManager/console.py
@@ -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):
-- 
1.9.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux