When event handler thread is created inside of
virCHStartEventHandler() the monitor object is refed because the thread
(virCHEventHandlerLoop()) that's created in the very next step
uses it. But right after that, the monitor object is unrefed,
which is wrong because it takes away the reference which was
handed over to the thread. The monitor must be unrefed inside the
thread, when no longer needed.
And while at it, move the unref call of the domain object after
the debug print which obviously accesses the domain definition.
Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
}
g_clear_pointer(&mon->event_buffer.buffer, g_free);
- virObjectUnref(vm);
VIR_DEBUG("%s: Event handler loop thread exiting", vm->def->name);
+ virObjectUnref(vm);
+ virObjectUnref(mon);
return;
}
virObjectUnref(mon);
return -1;
}
- virObjectUnref(mon);
g_atomic_int_set(&mon->event_handler_stop, 0);
return 0;