mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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)
|
mon->program) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mon->vm = vm;
|
mon->vm = virObjectRef(vm);
|
||||||
memcpy(&mon->cb, cb, sizeof(mon->cb));
|
memcpy(&mon->cb, cb, sizeof(mon->cb));
|
||||||
|
|
||||||
virObjectRef(mon);
|
virObjectRef(mon);
|
||||||
@ -201,6 +201,7 @@ static void virLXCMonitorDispose(void *opaque)
|
|||||||
if (mon->cb.destroy)
|
if (mon->cb.destroy)
|
||||||
(mon->cb.destroy)(mon, mon->vm);
|
(mon->cb.destroy)(mon, mon->vm);
|
||||||
virObjectUnref(mon->program);
|
virObjectUnref(mon->program);
|
||||||
|
virObjectUnref(mon->vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user