summaryrefslogtreecommitdiffstats
path: root/libvirt-override-virConnect.py
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2010-07-13 10:54:26 +0200
committerEric Blake <eblake@redhat.com>2010-07-23 13:26:40 -0600
commit1abf41565f9e434326aeb2d1d72754c424102b46 (patch)
tree48cfd074679aeca02310db4a112068bb11b0d020 /libvirt-override-virConnect.py
parenta877c16bac6edfb306501843ca313e1e1aabc68d (diff)
downloadlibvirt-python-v6-1abf41565f9e434326aeb2d1d72754c424102b46.tar.gz
libvirt-python-v6-1abf41565f9e434326aeb2d1d72754c424102b46.tar.xz
libvirt-python-v6-1abf41565f9e434326aeb2d1d72754c424102b46.zip
Fix SEGV on exit after domainEventDeregister()v0.8.4v0.8.3
When the last callback is removed using domainEventDeregister(), the events dispatcher is deregistered from the C-library, but domainEventsCallbacks is still an empty list. On shutdown __del__() deregisters the dispatacher again, which SEGVs # You need the event-loop implementation from the Python examples; # give the file a name which is importable by Python. ln examples/domain-events/events-python/event-test.py eloop.py python -c 'from eloop import * import sys def dump(*args): print " ".join(map(str, args)) virEventLoopPureStart() c = libvirt.open("xen:///") c.domainEventRegister(dump, None) c.domainEventDeregister(dump) sys.exit(0)' domainEventDeregister() needs to delete domainEventCallbacks so subsequent calls to __del__() and domainEventRegister() choose the right code paths. Setting it to None is not enough, since calling domainEventRegiser() again would trigger an TypeError. Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'libvirt-override-virConnect.py')
-rw-r--r--libvirt-override-virConnect.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py
index 52914dc..e344303 100644
--- a/libvirt-override-virConnect.py
+++ b/libvirt-override-virConnect.py
@@ -2,7 +2,7 @@
try:
for cb,opaque in self.domainEventCallbacks.items():
del self.domainEventCallbacks[cb]
- self.domainEventCallbacks = None
+ del self.domainEventCallbacks
libvirtmod.virConnectDomainEventDeregister(self._o, self)
except AttributeError:
pass
@@ -17,6 +17,7 @@
try:
del self.domainEventCallbacks[cb]
if len(self.domainEventCallbacks) == 0:
+ del self.domainEventCallbacks
ret = libvirtmod.virConnectDomainEventDeregister(self._o, self)
if ret == -1: raise libvirtError ('virConnectDomainEventDeregister() failed', conn=self)
except AttributeError: