On 24/03/2021 11.10, Thomas Huth wrote:
On 24/03/2021 00.35, Philippe Mathieu-Daudé wrote:
[...]
Hmmm does this assert() matches your comment?

-- >8 --
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index cefc5eaa0a9..41cbee77d14 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -1130,6 +1130,8 @@ Object *qdev_get_machine(void)
  {
      static Object *dev;

+    assert(phase_check(PHASE_MACHINE_CREATED));
+
      if (dev == NULL) {
          dev = container_get(object_get_root(), "/machine");
      }

Sounds like a good idea, but I think it should be sufficient to put it into the if-statement instead.

Scratch that. QEMU quickly asserts with that statement, which makes sense if you consider that container_get also creates the container objects along the way.

 Thomas


Reply via email to