]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix SEGV on exit after domainEventDeregister()
authorPhilipp Hahn <hahn@univention.de>
Tue, 13 Jul 2010 08:54:26 +0000 (10:54 +0200)
committerEric Blake <eblake@redhat.com>
Fri, 23 Jul 2010 19:26:40 +0000 (13:26 -0600)
commiteac63161cc68b3636d84bd5a17c4401d86217284
tree988c3fa979e2405ea345ad91c2c16d4aa34f7edb
parent2fc10e1a596adbb36f442e357884e8f5433e4598
Fix SEGV on exit after domainEventDeregister()

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>
python/libvirt-override-virConnect.py