mirror of https://github.com/xqemu/xqemu.git
vhost-user-test: fix crash with glib < 2.36
The prepare callback needs to be implemented with glib < 2.36, quoting glib documentation: "Since 2.36 this may be NULL, in which case the effect is as if the function always returns FALSE with a timeout of -1." Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
a899b1ea2a
commit
45ce512670
|
@ -506,11 +506,22 @@ test_migrate_source_check(GSource *source)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !GLIB_CHECK_VERSION(2,36,0)
|
||||||
|
/* this callback is unnecessary with glib >2.36, the default
|
||||||
|
* prepare for the source does the same */
|
||||||
|
static gboolean
|
||||||
|
test_migrate_source_prepare(GSource *source, gint *timeout)
|
||||||
|
{
|
||||||
|
*timeout = -1;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
GSourceFuncs test_migrate_source_funcs = {
|
GSourceFuncs test_migrate_source_funcs = {
|
||||||
NULL,
|
#if !GLIB_CHECK_VERSION(2,36,0)
|
||||||
test_migrate_source_check,
|
.prepare = test_migrate_source_prepare,
|
||||||
NULL,
|
#endif
|
||||||
NULL
|
.check = test_migrate_source_check,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void test_migrate(void)
|
static void test_migrate(void)
|
||||||
|
|
Loading…
Reference in New Issue