libvirt/src/uml
Daniel P. Berrange 707781fe12 Only add the timer when a callback is registered
The lifetime of the virDomainEventState object is tied to
the lifetime of the driver, which in stateless drivers is
tied to the lifetime of the virConnectPtr.

If we add & remove a timer when allocating/freeing the
virDomainEventState object, we can get a situation where
the timer still triggers once after virDomainEventState
has been freed. The timeout callback can't keep a ref
on the event state though, since that would be a circular
reference.

The trick is to only register the timer when a callback
is registered with the event state & remove the timer
when the callback is unregistered.

The demo for the bug is to run

  while true ; do date ; ../tools/virsh -q -c test:///default 'shutdown test; undefine test; dominfo test' ; done

prior to this fix, it will frequently hang and / or
crash, or corrupt memory
2011-12-19 11:08:25 +00:00
..
uml_conf.c Pass the VM's UUID into the nwfilter subsystem 2011-12-08 21:35:20 -05:00
uml_conf.h Split bridge.h into three separate files 2011-11-09 16:34:25 +00:00
uml_driver.c Only add the timer when a callback is registered 2011-12-19 11:08:25 +00:00
uml_driver.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00