If some errors happen before main_loop is initialized in colo compare thread, qemu will go into finalizing process where we call g_main_loop_quit(s->main_loop), if main_loop is NULL, there will be an error report: "(process:14861): GLib-CRITICAL **: g_main_loop_quit: assertion 'loop != NULL' failed".
We need to check if main_loop is NULL or not before call g_main_loop_quit(). Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> --- net/colo-compare.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index a6bf419..d6a5e4c 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -770,7 +770,9 @@ static void colo_compare_finalize(Object *obj) s->worker_context, true); qemu_chr_fe_deinit(&s->chr_out); - g_main_loop_quit(s->compare_loop); + if (s->compare_loop) { + g_main_loop_quit(s->compare_loop); + } qemu_thread_join(&s->thread); /* Release all unhandled packets after compare thead exited */ -- 1.8.3.1