mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
lxc: monitor now holds a reference to the domain
If the monitor doesn't hold a reference to the domain object the object may be destroyed before the monitor actually stops.
This commit is contained in:
parent
ce937d3710
commit
3cd556d486
@ -175,7 +175,7 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
|
||||
mon->program) < 0)
|
||||
goto error;
|
||||
|
||||
mon->vm = vm;
|
||||
mon->vm = virObjectRef(vm);
|
||||
memcpy(&mon->cb, cb, sizeof(mon->cb));
|
||||
|
||||
virObjectRef(mon);
|
||||
@ -201,6 +201,7 @@ static void virLXCMonitorDispose(void *opaque)
|
||||
if (mon->cb.destroy)
|
||||
(mon->cb.destroy)(mon, mon->vm);
|
||||
virObjectUnref(mon->program);
|
||||
virObjectUnref(mon->vm);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user