提交 f54c19ca 编写于 作者: H Hervé Poussineau 提交者: Andreas Färber

qom: Detect bad reentrance during object_class_foreach()

We should not modify the type hash table while it is being iterated on.
Assert that it does not happen.
Signed-off-by: NHervé Poussineau <hpoussin@reactos.org>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 14389dbd
......@@ -78,8 +78,11 @@ static GHashTable *type_table_get(void)
return type_table;
}
static bool enumerating_types;
static void type_table_add(TypeImpl *ti)
{
assert(!enumerating_types);
g_hash_table_insert(type_table_get(), (void *)ti->name, ti);
}
......@@ -670,7 +673,9 @@ void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
{
OCFData data = { fn, implements_type, include_abstract, opaque };
enumerating_types = true;
g_hash_table_foreach(type_table_get(), object_class_foreach_tramp, &data);
enumerating_types = false;
}
int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册