[Libvir] [PATCH] Python bindings: Use virDomain/NetworkGetConnect instead of storing connection in domain/network object
Daniel Veillard
veillard at redhat.com
Mon Jul 23 15:16:36 UTC 2007
On Mon, Jul 23, 2007 at 04:00:59PM +0100, Richard W.M. Jones wrote:
> Previously[1] I patched libvirt to add the virDomainGetConnect and
> virNetworkGetConnect functions. The rationale for these is explained
> here[2].
>
> The attached patch makes the Python bindings use these functions instead
> of storing the connection object explicitly.
Hum ... The problem was the following:
- you create a connection
- you get a domain pointer from the connection
- you delete the reference from the connection (e.g. by exiting
the method) but keep the domain object
- the connection count of the python object goes down to 0
- _del() is called on the object
- the connection is closed at the C level
- you have a dandling domain python object whose C pointer is dead
Are you sure your patch is safe ?
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list
mailing list