Commit 4e37e05f36 for qemu.org

commit 4e37e05f3663521fcffbb8eb9e41cf1e3441bc0b
Author: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Date:   Mon Sep 21 12:35:07 2026 +0100

    qom/object.c: improve duplicate class property detection assert()

    Introduce an intermediary boolean prop_already_exists into object_class_property_add()
    so that it is obvious to a developer if they inadvertantly introduce a duplicate
    class property:

    qemu-system-x86_64: ../qom/object.c:1417: object_class_property_add:
      Assertion `!prop_already_exists' failed.

    Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Message-ID: <20260921113559.1299740-2-mark.caveayland@nutanix.com>

diff --git a/qom/object.c b/qom/object.c
index 41b1ec81d4..914d1228ca 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1410,9 +1410,10 @@ object_class_property_add(ObjectClass *klass,
                           ObjectPropertyRelease *release,
                           void *opaque)
 {
+    bool prop_already_exists = object_class_property_find(klass, name);
     ObjectProperty *prop;

-    assert(!object_class_property_find(klass, name));
+    assert(!prop_already_exists);

     prop = g_malloc0(sizeof(*prop));