aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qom/object.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/qom/object.c b/qom/object.c
index a3da546366..66c4a5f1cb 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -592,23 +592,22 @@ static inline bool object_property_is_child(ObjectProperty *prop)
static void object_property_del_all(Object *obj)
{
+ g_autoptr(GHashTable) done = g_hash_table_new(NULL, NULL);
ObjectProperty *prop;
- GHashTableIter iter;
- gpointer key, value;
+ ObjectPropertyIterator iter;
bool released;
do {
released = false;
- g_hash_table_iter_init(&iter, obj->properties);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- prop = value;
- if (prop->release) {
- prop->release(obj, prop->name, prop->opaque);
- prop->release = NULL;
- released = true;
- break;
+ object_property_iter_init(&iter, obj);
+ while ((prop = object_property_iter_next(&iter)) != NULL) {
+ if (g_hash_table_add(done, prop)) {
+ if (prop->release) {
+ prop->release(obj, prop->name, prop->opaque);
+ released = true;
+ break;
+ }
}
- g_hash_table_iter_remove(&iter);
}
} while (released);