[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach |
Date: |
Tue, 3 Dec 2013 16:42:00 +0100 |
From: Hervé Poussineau <address@hidden>
We should not modify the type hash table while it is being iterated on.
Assert that it does not happen.
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
qom/object.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/qom/object.c b/qom/object.c
index 3a43186..1dee9f0 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -78,8 +78,10 @@ static GHashTable *type_table_get(void)
return type_table;
}
+static bool enumerating = false;
static void type_table_add(TypeImpl *ti)
{
+ assert(!enumerating);
g_hash_table_insert(type_table_get(), (void *)ti->name, ti);
}
@@ -666,7 +668,9 @@ void object_class_foreach(void (*fn)(ObjectClass *klass,
void *opaque),
{
OCFData data = { fn, implements_type, include_abstract, opaque };
+ enumerating = true;
g_hash_table_foreach(type_table_get(), object_class_foreach_tramp, &data);
+ enumerating = false;
}
int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
--
1.8.4.2
- [Qemu-devel] [PATCH 0/2] qom: fix registration of QOM interfaces, Paolo Bonzini, 2013/12/03
- [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Peter Crosthwaite, 2013/12/04
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Andreas Färber, 2013/12/15
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Alexey Kardashevskiy, 2013/12/19
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Andreas Färber, 2013/12/20
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Alexey Kardashevskiy, 2013/12/20
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Alexey Kardashevskiy, 2013/12/24
- Re: [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach, Andreas Färber, 2013/12/24
[Qemu-devel] [PATCH 1/2] qom: do not register interface "types" in the type table, Paolo Bonzini, 2013/12/03
Re: [Qemu-devel] [PATCH 0/2] qom: fix registration of QOM interfaces, Andreas Färber, 2013/12/15